vue.config.js 1.8 KB

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