bulb-webpack
v1.0.12
Published
### 使用说明
Downloads
28
Readme
Bulb Webpack
使用说明
安装
npm install bulb-webpack
配置
// 在项目的根目录下,可以暴露下面的配置文件
vue.config.js
//例子
module.exports = {
chainWebpack: (webpackConfig, environment, eggInfo) => {
webpackConfig
.externals({google:'google'})
webpackConfig
.plugin('DefinePlugin')
.get('args')[0]
.BULB_ENV = JSON.stringify(eggInfo.env) || '"local"'
webpackConfig
.plugin('DefinePlugin')
.get('args')[0]
.PROJECT_VER = JSON.stringify(`${ver}`)
}
}
调用
const BulbWebpack = require('bulb-webpack');
// 初始化bulb webpack实例,
// 如果没有输入参数,将使用默认设置,./lib/utils/defaults.js
const bulbWebpack = new BulbWebpack({xxx});
//初始化命令: dev / start模式 并设置支持的target,这里也可以设置一个userInfo,在后面webpackChian回调中的environment参数可以获取到这里的userInfo
const cmd = new BulbWebpack.Command('dev', {
targets:['client','server']
},{<userInfo>});
//启动打包
bulbWebpack.run(cmd);