vue.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. const webpack = require('webpack')
  2. const path = require('path')
  3. module.exports = {
  4. //路径前缀
  5. publicPath: "/",
  6. lintOnSave: true,
  7. productionSourceMap: false,
  8. chainWebpack: (config) => {
  9. //忽略的打包文件
  10. config.externals({
  11. 'vue': 'Vue',
  12. 'vue-router': 'VueRouter',
  13. 'vuex': 'Vuex',
  14. 'axios': 'axios',
  15. 'element-ui': 'ELEMENT',
  16. });
  17. const entry = config.entry('app');
  18. entry.add('babel-polyfill').end();
  19. entry.add('classlist-polyfill').end();
  20. entry.add('@/mock').end();
  21. },
  22. css: {
  23. extract: { ignoreOrder: true }
  24. },
  25. //开发模式反向代理配置,生产模式请使用Nginx部署并配置反向代理
  26. devServer: {
  27. port: 1888,
  28. proxy: {
  29. '/api/blade-visual': {
  30. target: 'https://data.bladex.vip',
  31. ws: true,
  32. pathRewrite: {
  33. '^/api': '/'
  34. }
  35. },
  36. '/api': {
  37. //本地服务接口地址
  38. // target: 'http://192.168.1.244',
  39. target: 'http://36.103.227.152:1777/api',
  40. // target: 'http://192.168.1.69',
  41. //远程演示服务地址,可用于直接启动项目
  42. //target: 'https://saber.bladex.vip/api',
  43. ws: true,
  44. pathRewrite: {
  45. '^/api': '/'
  46. }
  47. },
  48. }
  49. },
  50. configureWebpack: {
  51. plugins: [
  52. new webpack.ProvidePlugin({
  53. $:"jquery",
  54. jQuery:"jquery",
  55. "windows.jQuery":"jquery"
  56. })
  57. ]
  58. }
  59. };