vue.config.js 930 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. // 请到 src/config/index.json 文件中修改 target 属性
  30. target: config.target,
  31. ws: true,
  32. pathRewrite: {
  33. '^/api': '/'
  34. }
  35. }
  36. }
  37. }
  38. };