vue.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const path = require('path')
  2. const minify = process.env.NODE_ENV === 'development' ? false : {
  3. collapseWhitespace: true,
  4. removeComments: true,
  5. removeRedundantAttributes: true,
  6. removeScriptTypeAttributes: true,
  7. removeStyleLinkTypeAttributes: true,
  8. useShortDoctype: true,
  9. minifyCSS: true,
  10. minifyJS: true
  11. }
  12. function resolve(dir) {
  13. return path.join(__dirname, dir)
  14. }
  15. module.exports = {
  16. publicPath: '/',
  17. // pages: {
  18. // index: {
  19. // entry: 'src/views/index/main.js',
  20. // template: 'public/index.html',
  21. // filename: 'index.html',
  22. // chunks: ['chunk-vendors', 'chunk-common', 'index'],
  23. // minify
  24. // },
  25. // preview: {
  26. // entry: 'src/views/preview/main.js',
  27. // template: 'public/preview.html',
  28. // filename: 'preview.html',
  29. // chunks: ['chunk-vendors', 'chunk-common', 'preview'],
  30. // minify
  31. // }
  32. // },
  33. devServer: {
  34. overlay: false
  35. },
  36. productionSourceMap: false,
  37. configureWebpack: {
  38. },
  39. chainWebpack(config) {
  40. config.resolve.alias.set('@', resolve('src'))
  41. // set svg-sprite-loader
  42. config.module
  43. .rule('svg')
  44. .exclude.add(resolve('src/icons'))
  45. .end()
  46. config.module
  47. .rule('icons')
  48. .test(/\.svg$/)
  49. .include.add(resolve('src/icons'))
  50. .end()
  51. .use('svg-sprite-loader')
  52. .loader('svg-sprite-loader')
  53. .options({
  54. symbolId: 'icon-[name]'
  55. })
  56. .end()
  57. }
  58. }