Webpack vs gulp-webpack
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Webpack vs gulp-webpack相关的知识,希望对你有一定的参考价值。
我正在尝试从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:意外的令牌(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 [emit] [big] main bundle.js.map 3.71 MB 0 [emit] main [8] ./~/reactxp /index.js 146字节{0} [built] [112] ./out/js/ExercisesStore.js 3.29 kB {0} [built] [120] ./~/amazon-cognito-identity-js/es/CognitoRefreshToken .js 1.4 kB {0} [built] [126] ./~/amazon-cognito-identity-js/es/index.js 1.58 kB {0} [built] [217] ./out/js/App3.js 14.4 kB {0} [built] [278] ./~/jwt-decode/lib/index.js 680字节{0} [built] [490] ./ out/js/AlertAndPromptWeb.js 3.4 kB {0} [ [494] ./out/js/EditExerciseAttributePropertiesPanel.js 10.4 kB {0} [built] [495] ./out/js/EditExerciseAttributesValuesPanel.js 9.4 kB {0} [built] [496] ./out/js /EditExerciseCategoryPropertiesPanel.js 5.78 kB {0} [built] [497] ./out/js/EditExerciseMainPropertiesPanel.js 4.91 kB {0} [built] [498] ./out/js/ExercicesTopLevelView.js 13.7 kB {0} [建立] [502] ./out/js/LogHelper.js 791字节{0} [建造] [504] ./ out/js/asyncco gnito.js 2.08 kB {0} [built] [505] ./out/js/index.js 599字节{0} [内置] + 491个隐藏模块
我做错了但我找不到它是什么。
任何帮助赞赏。
好的,在重新安装节点模块时,我收到了一条警告消息,告诉我一个解决方案:
npm WARN弃用gulp-webpack@1.5.0:改名为https://www.npmjs.com/package/webpack-stream
因此,在删除不推荐使用的进度配置选项后,我切换到此模块并立即工作。
以上是关于Webpack vs gulp-webpack的主要内容,如果未能解决你的问题,请参考以下文章