新的工程,package.json 里 script.build = "node build/build.js"
然后在 build.js 里面执行,今天回调里面写了个上传 cdn 的方法
const webpack = require('webpack')
webpack(webpackConfig, (err, stats) => {
uploadCDN(stats.compilation.assets)
})
然后我想复用这个 uploadCDN 到一个老工程里面,没想到老工程不是这个 build 模式:
package.json build = "webpack --config build/webpack.prod.js"
webpack.prod.js 如下
const webpack = require('webpack')
const base = require('./webpack.base')
base.entry = {}
base.output = {}
base.plugins.push()
base.stats = {}
module.exports = base
所以想问一下 webpack.base 有没有一个配置 post script 的地方,让我直接把 uploadCDN 放进去?