1、修改packjson
新增一个要编译的命令
"builddev": "node build/builddev.js"
2、新建一个builddev.js
process.env.type = ‘"builddev"‘ require(‘./build‘)
3、index.js修改
把build复制一份,修改相应的index、assetsRoot、assetsSubDirectory、assetsPublicPath
4、修改webpack.base.conf.js
publicPath: process.env.NODE_ENV === ‘production‘ ? (process.env.type == ‘"builddev"‘ ? config.builddev.assetsPublicPath : config.build.assetsPublicPath) : config.dev.assetsPublicPath
5、修改webpack.prod.conf.js
output: { path: process.env.type == ‘"builddev"‘ ? config.builddev.assetsRoot : config.build.assetsRoot },
原文地址:https://www.cnblogs.com/qzccl/p/9640653.html
时间: 2024-11-03 14:27:01