vue.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: 1991,
  27. proxy: {
  28. '/api/blade-visual': {
  29. target: 'https://data.bladex.vip',
  30. ws: true,
  31. pathRewrite: {
  32. '^/api': '/'
  33. }
  34. },
  35. '/api': {
  36. // target: 'http://localhost',
  37. //测试环境地址
  38. target: 'http://36.103.227.152:1777/api',
  39. ws: true,
  40. pathRewrite: {
  41. '^/api': '/'
  42. }
  43. },
  44. }
  45. },
  46. configureWebpack: {
  47. plugins: [
  48. new webpack.ProvidePlugin({
  49. $:"jquery",
  50. jQuery:"jquery",
  51. "windows.jQuery":"jquery"
  52. })
  53. ]
  54. }
  55. };