<title><%= htmlWebpackPlugin.options.title %></title>
const path = require('path')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
function resolve (dir) {
return path.join(__dirname, dir)
}
module.exports = {
productionSourceMap: false,
lintOnSave: false,
devServer: {
port: '8080',
open: true,
hot: true,
disableHostCheck: true,
clientLogLevel: 'warning',
overlay: {
warnings: false,
errors: true
}
},
configureWebpack: {
devtool: 'source-map',
name: 'dfdf',
resolve: {
alias: {
'@': resolve('src')
}
},
plugins: [
]
},
css: {
loaderOptions: {
sass: {
prependData: '@import "@/views/customerSOP/styles/common.scss";'
}
}
},
chainWebpack: config => {
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
html2canvas: {
name: 'chunk-html2canvas',
test: /[/]node_modules[/]_?html2canvas(.*)/,
priority: 10
},
swiper: {
name: 'chunk-swiper',
test: /[/]node_modules[/]_?swiper(.*)/,
priority: 10
},
vant: {
name: 'chunk-vant',
priority: 20,
test: /[/]node_modules[/]_?vant(.*)/
},
commons: {
name: 'chunk-commons',
minChunks: 2,
priority: 5,
chunks: 'initial',
reuseExistingChunk: true
},
corejs: {
name: 'chunk-corejs',
test: /[/]node_modules[/]_?core-js(.*)/,
priority: 10
}
}
})
config.module
.rule('svgIcon')
.test(/\.svg$/)
.include
.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.tap(options => {
options = {
symbolId: 'icon-[name]'
}
return options
})
config.module
.rule('svg')
.exclude
.add(resolve('src/icons'))
.end()
config
.plugin('html')
.tap(args => {
const date = new Date()
args[0].title = '珍客销售云'
args[0].createDate = date
return args
})
}
}
config
.plugin('html')
.tap(args => {
const date = new Date()
args[0].title = '珍客销售云'
args[0].createDate = date
return args
})
}
chainWebpack: config => {
config.plugin('extract-css').tap(args => [{
filename: `css/[name].[contenthash].css`,
chunkFilename: `css/[name].[contenthash].css`
}])
},
configureWebpack: config => {
config.output.filename = `js/[name].[contenthash].js`
config.output.chunkFilename = `js/[name].[contenthash].js`
}