vue项目将css,js全部打包到html文件配置

module.exports={
publicPath: './',//使用相对路径
productionSourceMap: false,
// publicPath:"./", // 可以设置成相对路径,这样所有的资源都会被链接为相对路径,打出来的包可以被部署在任意路径
outputDir:"dist", //打包时生成的生产环境构建文件的目录
chainWebpack: config => {
config.plugin('preload')
.tap(args => {
args[0].fileBlacklist.push(/\.css/, /\.js/)
return args
})
config.plugin('inline-source')
.use(require('html-webpack-inline-source-plugin'))
config
.plugin('html')
.tap(args => {
args[0].title = 'JSON和PHP Array 互转'
args[0].inlineSource = '(\.css|\.js$)'
return args
})
}
}

猜你喜欢

转载自www.cnblogs.com/lcosima/p/12622702.html
今日推荐