vue.config.js 860 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const config = require('./src/config/index.json');
  2. module.exports = {
  3. //路径前缀
  4. publicPath: "/",
  5. lintOnSave: true,
  6. productionSourceMap: false,
  7. chainWebpack: (config) => {
  8. //忽略的打包文件
  9. config.externals({
  10. 'vue': 'Vue',
  11. 'vue-router': 'VueRouter',
  12. 'vuex': 'Vuex',
  13. 'axios': 'axios',
  14. 'element-ui': 'ELEMENT',
  15. });
  16. const entry = config.entry('app');
  17. entry.add('babel-polyfill').end();
  18. entry.add('classlist-polyfill').end();
  19. entry.add('@/mock').end();
  20. },
  21. css: {
  22. extract: {ignoreOrder: true}
  23. },
  24. //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
  25. devServer: {
  26. ...config.dev,
  27. proxy: {
  28. '/api': {
  29. target: config.target,
  30. ws: true,
  31. pathRewrite: {
  32. '^/api': '/'
  33. }
  34. }
  35. }
  36. }
  37. };