vue.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const webpack = require('webpack')
  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. port: 1889,
  27. proxy: {
  28. '/api': {
  29. //本地服务接口地址
  30. target: 'http://localhost',
  31. // target: 'http://192.168.1.160:1889/api',
  32. // target: 'http://8.135.18.59:1889/api',
  33. // target: 'http://36.103.227.152:1777/api',
  34. ws: true,
  35. pathRewrite: {
  36. '^/api': '/'
  37. }
  38. }
  39. }
  40. },
  41. configureWebpack: {
  42. plugins: [
  43. new webpack.ProvidePlugin({
  44. $:"jquery",
  45. jQuery:"jquery",
  46. "windows.jQuery":"jquery"
  47. })
  48. ]
  49. }
  50. };