vue.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. const path = require('path')
  2. function resolve(dir) {
  3. return path.join(__dirname, dir)
  4. }
  5. module.exports = {
  6. publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
  7. runtimeCompiler: true,
  8. productionSourceMap: false,
  9. chainWebpack: (config) => {
  10. config.resolve.alias.set('@/', resolve('src'))
  11. // config.plugins.delete('prefetch')
  12. },
  13. css: {
  14. loaderOptions: {
  15. less: {
  16. modifyVars: {
  17. },
  18. javascriptEnabled: true,
  19. }
  20. }
  21. },
  22. // 入口设置
  23. pages: {
  24. datav: {
  25. entry: 'src/datav/main.js',
  26. template: 'src/datav/index.html',
  27. title: 'datav',
  28. filename: 'datav.html',
  29. chunks: ['chunk-vendors', 'chunk-common', 'datav']
  30. },
  31. index: {
  32. entry: 'src/main.js',
  33. template: 'public/index.html',
  34. title: 'index.html',
  35. filename: 'index.html'
  36. }
  37. },
  38. devServer: {
  39. index: '/index.html', // 运行时,默认打开index页面
  40. port: 3000,
  41. proxy: {
  42. '/api': {
  43. target: process.env.VUE_APP_SERVER_URL,
  44. changeOrigin: true,
  45. pathRewrite: {
  46. '^/api': ''
  47. }
  48. },
  49. '/file': {
  50. target: process.env.VUE_APP_SERVER_URL,
  51. changeOrigin: true,
  52. pathRewrite: {
  53. '^/file': '/file'
  54. }
  55. }
  56. }
  57. },
  58. lintOnSave: undefined
  59. }