vue.config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. let targetUrl = 'https://mteatest.dayaedu.com'
  2. // let targetUrl = 'http://192.168.3.20:8000'
  3. // let targetUrl = 'https://online.dayaedu.com'
  4. // let targetUrl = 'http://dev.dayaedu.com/'
  5. // let targetUrl = 'http://192.168.3.124:8000'
  6. module.exports = {
  7. chainWebpack: config => {
  8. config.devtool('inline-source-map')
  9. config.output.filename('[name].[hash].js').end();
  10. // // chunkHash
  11. // config.output.filename(`js/[name].[chunkhash].${Version}.js`).end();
  12. // config.output.chunkFilename(`js/[id].[chunkhash].${Version}.js`).end();
  13. // config.output.filename(`js/[name].[chunkhash].js`).end();
  14. // config.output.chunkFilename(`js/[id].[chunkhash].js`).end();
  15. // config.entry.app = ['babel-polyfill', './src/main.js']
  16. // config.resolve.symlinks(true)
  17. // config.plugin('html').tap(args => {
  18. // args[0].chunksSortMode = 'none'
  19. // return args
  20. // })
  21. config.plugin('html').tap(args => {
  22. args[0].minify = {
  23. removeAttributeQuotes: false
  24. }
  25. return args
  26. })
  27. },
  28. // eslint-loader 是否在保存的时候检查
  29. lintOnSave: true,
  30. // 是否使用包含运行时编译器的Vue核心的构建
  31. runtimeCompiler: false,
  32. // 生产环境 sourceMap
  33. productionSourceMap: false,
  34. configureWebpack: () => { },
  35. // 配置 webpack-dev-server 行为。
  36. devServer: {
  37. open: process.platform === 'darwin',
  38. host: '0.0.0.0',
  39. port: 9999,
  40. // https: true,
  41. hotOnly: false,
  42. // 查阅 https://github.com/vuejs/vue-doc-zh-cn/vue-cli/cli-service.md#配置代理
  43. proxy: {
  44. '/contracts': {
  45. target: targetUrl,
  46. changeOrigin: true,
  47. ws: true,
  48. '^/contracts': '/contracts',
  49. xfwd: true
  50. },
  51. '/api-student': {
  52. target: targetUrl,
  53. changeOrigin: true,
  54. ws: true,
  55. '^/api-student': '/api-student',
  56. xfwd: true
  57. },
  58. '/api-cms': {
  59. target: targetUrl,
  60. changeOrigin: true,
  61. ws: true,
  62. '^/api-cms': '/api-cms',
  63. xfwd: true
  64. },
  65. '/api-teacher': {
  66. target: targetUrl,
  67. changeOrigin: true,
  68. ws: true,
  69. '^/api-teacher': '/api-teacher',
  70. xfwd: true
  71. },
  72. '/api-web': {
  73. target: targetUrl,
  74. changeOrigin: true,
  75. ws: true,
  76. '^/api-web': '/api-web',
  77. xfwd: true
  78. },
  79. '/api-auth': {
  80. target: targetUrl,
  81. changeOrigin: true,
  82. ws: true,
  83. '^/api-auth': '/api-auth',
  84. xfwd: true
  85. }
  86. }, // string | Object
  87. },
  88. css: {
  89. loaderOptions: {
  90. less: {
  91. modifyVars: {
  92. // red: '#03a9f4',
  93. blue: '#01C1B5',
  94. // orange: '#f08d49',
  95. // 'text-color': '#111'
  96. }
  97. }
  98. }
  99. },
  100. }