vue.config.js 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict'
  2. const path = require('path')
  3. function resolve (dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. module.exports = {
  7. publicPath: './',
  8. outputDir: 'admin',
  9. assetsDir: 'static',
  10. lintOnSave: true,
  11. productionSourceMap: false,
  12. devServer: {
  13. open: true,
  14. host: 'localhost',
  15. port: 8002,
  16. https: false,
  17. hotOnly: false,
  18. proxy: {
  19. '/api': {
  20. target: 'http://localhost:8000',
  21. changeOrigin: true
  22. }
  23. }
  24. },
  25. pages: {
  26. index: {
  27. entry: 'src/main.js',
  28. template: 'public/index.html',
  29. filename: 'index.html'
  30. }
  31. },
  32. chainWebpack (config) {
  33. // set svg-sprite-loader
  34. config.module
  35. .rule('svg')
  36. .exclude.add(resolve('src/icons'))
  37. .end()
  38. config.module
  39. .rule('icons')
  40. .test(/\.svg$/)
  41. .include.add(resolve('src/icons'))
  42. .end()
  43. .use('svg-sprite-loader')
  44. .loader('svg-sprite-loader')
  45. .options({
  46. symbolId: 'icon-[name]'
  47. })
  48. .end()
  49. }
  50. }