|
@ -1,6 +1,8 @@ |
|
|
'use strict' |
|
|
'use strict' |
|
|
|
|
|
|
|
|
const path = require('path') |
|
|
const path = require('path') |
|
|
|
|
|
const buildConf = require('./build.config') |
|
|
|
|
|
const packageConf = require('./package.json') |
|
|
|
|
|
|
|
|
function resolve(dir) { |
|
|
function resolve(dir) { |
|
|
return path.join(__dirname, dir) |
|
|
return path.join(__dirname, dir) |
|
@ -63,13 +65,31 @@ module.exports = { |
|
|
// 不打包 begin
|
|
|
// 不打包 begin
|
|
|
// 1.目前已经测试通过[vue,axios,echarts]可以cdn引用,其它组件测试通过后可继续添加
|
|
|
// 1.目前已经测试通过[vue,axios,echarts]可以cdn引用,其它组件测试通过后可继续添加
|
|
|
// 2.此处添加不打包后,需在public/index.html head中添加相应cdn资源链接
|
|
|
// 2.此处添加不打包后,需在public/index.html head中添加相应cdn资源链接
|
|
|
config.set('externals', { |
|
|
|
|
|
vue: 'Vue', |
|
|
|
|
|
axios: 'axios', |
|
|
|
|
|
echarts: 'echarts' |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
config.set('externals', buildConf.cdns.reduce((p, a) => { |
|
|
|
|
|
p[a.name] = a.scope |
|
|
|
|
|
return p |
|
|
|
|
|
},{})) |
|
|
// 不打包 end
|
|
|
// 不打包 end
|
|
|
|
|
|
|
|
|
|
|
|
config.plugin('html') |
|
|
|
|
|
.tap(args => { |
|
|
|
|
|
if(buildConf.title) { |
|
|
|
|
|
args[0].title = buildConf.title |
|
|
|
|
|
} |
|
|
|
|
|
if(buildConf.cdns.length > 0) { |
|
|
|
|
|
args[0].cdns = buildConf.cdns.map(conf => { |
|
|
|
|
|
if (conf.path) { |
|
|
|
|
|
conf.js = `${buildConf.baseCdnUrl}${conf.path}` |
|
|
|
|
|
} else { |
|
|
|
|
|
conf.js = `${buildConf.baseCdnUrl}/${conf.name}/${packageConf.dependencies[conf.name].replace('^', '')}/${conf.name}.min.js` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return conf |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
return args |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
config |
|
|
config |
|
|
.plugin('ScriptExtHtmlWebpackPlugin') |
|
|
.plugin('ScriptExtHtmlWebpackPlugin') |
|
|
.after('html') |
|
|
.after('html') |
|
|