vue.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * 配置该文件可以参考:
  3. * https://cli.vuejs.org/zh/config/#%E7%9B%AE%E6%A0%87%E6%B5%8F%E8%A7%88%E5%99%A8
  4. *
  5. */
  6. const url = 'http://127.0.0.1:9998'
  7. // 基础路径,发布前修改这里,当前配置打包出来的资源都是相对路径
  8. let publicPath = './'
  9. module.exports = {
  10. publicPath: publicPath,
  11. lintOnSave: true,
  12. productionSourceMap: false,
  13. css: {
  14. // 忽略 CSS order 顺序警告
  15. extract: { ignoreOrder: true }
  16. },
  17. chainWebpack: config => {
  18. const entry = config.entry('app')
  19. entry
  20. .add('babel-polyfill')
  21. .end()
  22. entry
  23. .add('classlist-polyfill')
  24. .end()
  25. },
  26. configureWebpack: config => {
  27. // 为生产环境修改配置...
  28. if (process.env.NODE_ENV === 'production') {
  29. config.mode = 'production';
  30. // 打包文件大小配置
  31. config.performance = {
  32. maxEntrypointSize: 10000000,
  33. maxAssetSize: 30000000
  34. }
  35. }
  36. },
  37. // 配置转发代理
  38. devServer: {
  39. proxy: {
  40. '/': {
  41. target: url,
  42. ws: true,
  43. pathRewrite: {
  44. '^/': '/'
  45. }
  46. }
  47. }
  48. }
  49. }