我正在尝试从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)您可能需要适当的加载程序来处理此文件类型。语法错误:意外令牌(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资产大小块名称chunk名称bundle.js 3.07 MB 0 [已发出] [big]主bundle.js.map 3.71 MB 0 [已发出] main [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个隐藏模块
我做错了,但找不到。
任何帮助表示赞赏。
好的,在重新安装节点模块时,出现一条警告消息,导致我做出了解决:
npm WARN不推荐使用[email protected]:重命名为https://www.npmjs.com/package/webpack-stream
因此,在删除了已弃用的进度配置选项后,我切换到了该模块并立即工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句