vue.config.js 1.8 KB

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