You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.1 KiB

  1. /**
  2. * 配置参考:
  3. * https://cli.vuejs.org/zh/config/
  4. */
  5. const url = process.env.VUE_APP_BASE_API // 配置.env文件通过运行命令启动不同调试环境
  6. const productionGzipExtensions = ['js', 'css']
  7. module.exports = {
  8. lintOnSave: true,
  9. productionSourceMap: false,
  10. chainWebpack: config => {
  11. const entry = config.entry('app')
  12. entry
  13. .add('babel-polyfill')
  14. .end()
  15. entry
  16. .add('classlist-polyfill')
  17. .end()
  18. },
  19. css: {
  20. // 忽略 CSS order 顺序警告
  21. extract: { ignoreOrder: true }
  22. },
  23. configureWebpack: (config) => {
  24. if (process.env.NODE_ENV === 'production') {
  25. // 仅在生产环境下启用该配置
  26. return {
  27. performance: {
  28. // 打包后最大文件大小限制
  29. maxAssetSize: 1024000
  30. },
  31. }
  32. }
  33. },
  34. // 配置转发代理
  35. devServer: {
  36. open: true,
  37. disableHostCheck: true,
  38. port: 8080,
  39. proxy: {
  40. '/': {
  41. target: url,
  42. ws: false, // 需要websocket 开启
  43. pathRewrite: {
  44. '^/': '/'
  45. }
  46. },
  47. // 3.5 以后不需要再配置
  48. }
  49. }
  50. }