| | |
| | | const IS_VENDOR = /[\\/]node_modules[\\/]/ |
| | | const pageVendor = {} |
| | | |
| | | const pkg = require('./package.json') |
| | | const timestamp = new Date().getTime() |
| | | const queryStr = `?v=${pkg.version}&t=${timestamp}` |
| | | |
| | | glob.sync('./src/pages/**/main.ts').forEach(path => { |
| | | const chunk = path.split('./src/pages/')[1].split('/main.ts')[0] |
| | | const chunk_vendor = `${chunk}-vendors` |
| | |
| | | chainWebpack: config => { |
| | | config.plugins.delete('named-chunks') |
| | | if (process.env.NODE_ENV === 'production') { |
| | | config.output.filename('js/[name].js').end() |
| | | config.output.chunkFilename('js/[name].js').end() |
| | | config.output.filename('js/[name].js' + queryStr).end() |
| | | config.output.chunkFilename('js/[name].js' + queryStr).end() |
| | | // 修改生产配置 |
| | | config.plugin('extract-css').tap(() => [ |
| | | { |
| | | filename: `css/[name].css`, |
| | | chunkFilename: `css/[name].css` |
| | | filename: `css/[name].css${queryStr}`, |
| | | chunkFilename: `css/[name].css${queryStr}` |
| | | } |
| | | ]) |
| | | } |