vue.config.js 3.2 KB

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