[英]Output filename for gulp/webpack task
I'm using webpack-stream to integrate webpack into a gulp task, as below: 我正在使用webpack-stream将webpack集成到gulp任务中,如下所示:
var gulp = require("gulp");
// var webpack = require('gulp-webpack');
var webpack = require('webpack-stream');
gulp.task("min:webpack",
function () {
return gulp.src('./App/App.js')
.pipe(webpack({
// watch: true,
module: {
entry: './App/App.js',
output: {
filename: 'App.bundle.js'
},
devtool: 'source-map'
}
}))
.pipe(gulp.dest('./App'));
});
Everything seems to be working as expected, except that the output file is always something like 6f7af85206d7f2f6536d.js
instead of the expected App.bundle.js
. 除了输出文件始终类似于
6f7af85206d7f2f6536d.js
而不是预期的App.bundle.js
之外,其他所有内容似乎都按预期工作。 In other similar questions (eg, How to use gulp webpack-stream to generate a proper named file? ), I've read that it was fixed effectively by specifying output: { filename: 'something'}
in the configuration, but you can see that I'm doing that. 在其他类似的问题中(例如, 如何使用gulp webpack-stream生成正确的命名文件? ),我读到它已通过在配置中指定
output: { filename: 'something'}
而得到有效修复,但是您可以看到我正在做。
Any suggestions? 有什么建议么? Anything I'm overlooking?
我忽略了什么?
OK, dumb mistake on my part. 好吧,我这是愚蠢的错误。 I had the configuration specified incorrectly.
我没有正确指定配置。 This config works as expected:
此配置按预期工作:
gulp.task("min:webpack",
function () {
return gulp.src('./App/App.js')
.pipe(webpack({
// watch: true,
entry: './App/App.js',
output: {
filename: 'App.bundle.js'
},
devtool: 'source-map'
}))
.pipe(gulp.dest('./App'));
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.