12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- const path = require('path')
- const minify = process.env.NODE_ENV === 'development' ? false : {
- collapseWhitespace: true,
- removeComments: true,
- removeRedundantAttributes: true,
- removeScriptTypeAttributes: true,
- removeStyleLinkTypeAttributes: true,
- useShortDoctype: true,
- minifyCSS: true,
- minifyJS: true
- }
- function resolve(dir) {
- return path.join(__dirname, dir)
- }
- module.exports = {
- publicPath: '/',
- pages: {
- index: {
- entry: 'src/main.js',
- template: 'public/index.html',
- filename: 'index.html',
- chunks: ['chunk-vendors', 'chunk-common', 'index'],
- minify
- },
- preview: {
- entry: 'src/views/preview/main.js',
- template: 'public/preview.html',
- filename: 'preview.html',
- chunks: ['chunk-vendors', 'chunk-common', 'preview'],
- minify
- }
- },
- devServer: {
- overlay: false
- },
- productionSourceMap: false,
- configureWebpack: {
- },
- chainWebpack(config) {
- config.resolve.alias.set('@', resolve('src'))
- // set svg-sprite-loader
- config.module
- .rule('svg')
- .exclude.add(resolve('src/icons'))
- .end()
- config.module
- .rule('icons')
- .test(/\.svg$/)
- .include.add(resolve('src/icons'))
- .end()
- .use('svg-sprite-loader')
- .loader('svg-sprite-loader')
- .options({
- symbolId: 'icon-[name]'
- })
- .end()
- }
- }
|