简体   繁体   English

使用Webpack构建资产时,请确保使用有效的软件包版本

[英]Ensure valid package version is used when building assets with webpack

We are building our assets with webpack. 我们正在使用webpack建立我们的资产。 Recently I had to update graft-js-plugins-editor from 2.0.0-beta1 to 2.0.0-beta5. 最近,我不得不将graft-js-plugins-editor从2.0.0-beta1更新到2.0.0-beta5。 When my college pulled the change they forgot to run npm install before building the assets and deployed the old version of the package 当我的大学npm install更改时,他们忘记了在构建资产并部署旧版软件包之前运行npm install

How can we ensure that the version specified in package.json is used to build the assets? 我们如何确保使用package.json中指定的版本来构建资产?

// package.json
"scripts": {
    "build-production": "gulp production"
}

// Gulpfile
gulp.task('production', ['clean', 'mkdir-assets', 'webpack-production']);
...
var webpackStream = require('webpack-stream');
gulp.task('webpack-production', function(){
  return gulp.src(config.webpack.src)
    .pipe(webpackStream(config.webpack.production))
    .pipe(assetManifest(config.assetManifest.js))
    .pipe(gulp.dest(config.webpack.dest));
});

将诸如gulp-install之类的东西添加到build-production脚本的第一个任务中?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM