gpt4 book ai didi

webpack - Gulp webpack-stream 运行生产

转载 作者:行者123 更新时间:2023-12-04 00:06:18 25 4
gpt4 key购买 nike

我使用 gulp 运行 Webpack,带有 webpack-stream。

我用这个config和我一起工作。

如何从 gulp 运行 Webpack production-build webpack -p

最佳答案

Webpack 4 支持在配置对象中指定 mode: "production"

这是配置(无耻地借用 Sven 的回答):

var gulp = require('gulp');
var webpackStream = require('webpack-stream');
var webpack4 = require('webpack'); // Assuming we've installed Webpack 4+

gulp.task('default', function() {
var options = {
mode: "production"
};
return gulp.src('src/entry.js')
.pipe(webpackStream(options, webpack4))
.pipe(gulp.dest('dist/'));
});

关于webpack - Gulp webpack-stream 运行生产,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42509830/

25 4 0