【问题标题】:Webpack vs gulp-webpackWebpack 与 gulp-webpack
【发布时间】:2018-06-03 08:55:23
【问题描述】:

我正在尝试让 gulp 中的 webpack 处理包含 .js 文件的目录。我正在使用 gulp-webpack 1.5.0。 Gulp 任务定义为:

return gulp.src(joinPath(config.aliasify.dest, 'index.js'))
            .pipe(webpack( require('./_____webpack.config.js') ))
            .pipe(gulp.dest('dist/'));

_____webpack.config.js 是:

var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');

module.exports = {
    stats: {
        // Configure the console output
        errorDetails: true,
        colors: true,
        modules: true,
        reasons: true
    },
    progress: true,
    entry: "./out/js/index.js",
    output: {
        filename: "bundle.js",
        path: __dirname + "/dist"
    }

}

失败得很惨。 JSON文件似乎有问题:

./~/aws-sdk/apis/cognito-idp-2016-04-18.paginators.json 中的错误 模块解析失败:/Users/omatrot/Projects/trash/reactxp/samples/hello-world/node_modules/aws-sdk/apis/cognito-idp-2016-04-18.paginators.json 意外令牌 (2:14) 您可能需要适当的加载程序来处理此文件类型。 SyntaxError: Unexpected token (2:14)

在同一个目录上运行 webpack 并具有明显相同的配置工作正常。

webpack.config.ts file is:

import * as webpack from 'webpack';

const config: webpack.Configuration = {
    entry: "./out/js/index.js",
    output: {
        filename: "bundle.js",
        path: __dirname + "/dist"
    },

};

export default config;

webpack --display-error-details --progress --colors

哈希:0a378df14f58624d244f 版本:webpack 2.2.1 时间:3920ms 资产大小块块名称 bundle.js 3.07 MB 0 [发出] [大] 主要 bundle.js.map 3.71 MB 0 [发射] 主要 [8] ./~/reactxp/index.js 146 字节 {0} [内置] [112] ./out/js/ExercisesStore.js 3.29 kB {0} [内置] [120] ./~/amazon-cognito-identity-js/es/CognitoRefreshToken.js 1.4 kB {0} [内置] [126] ./~/amazon-cognito-identity-js/es/index.js 1.58 kB {0} [内置] [217] ./out/js/App3.js 14.4 kB {0} [内置] [278] ./~/jwt-decode/lib/index.js 680 字节 {0} [内置] [490] ./out/js/AlertAndPromptWeb.js 3.4 kB {0} [内置] [494] ./out/js/EditExerciseAttributePropertiesPanel.js 10.4 kB {0} [内置] [495] ./out/js/EditExerciseAttributesValuesPanel.js 9.4 kB {0} [内置] [496] ./out/js/EditExerciseCategoryPropertiesPanel.js 5.78 kB {0} [内置] [497] ./out/js/EditExerciseMainPropertiesPanel.js 4.91 kB {0} [内置] [498] ./out/js/ExercicesTopLevelView.js 13.7 kB {0} [内置] [502] ./out/js/LogHelper.js 791 字节 {0} [内置] [504] ./out/js/asynccognito.js 2.08 kB {0} [内置] [505] ./out/js/index.js 599 字节 {0} [内置] + 491 个隐藏模块

我做错了,但我找不到它是什么。

任何帮助表示赞赏。

【问题讨论】:

    标签: webpack gulp gulp-webpack


    【解决方案1】:

    好的,在重新安装节点模块时,我收到了一条警告消息,让我找到了解决方案:

    npm WARN 已弃用 gulp-webpack@1.5.0:重命名为 https://www.npmjs.com/package/webpack-stream

    所以我切换到这个模块,它在删除已弃用的进度配置选项后立即工作。

    【讨论】:

      猜你喜欢
      • 2015-10-03
      • 2017-03-27
      • 1970-01-01
      • 2018-07-06
      • 1970-01-01
      • 2018-11-23
      • 1970-01-01
      • 2017-02-06
      • 2017-06-30
      相关资源
      最近更新 更多