vue.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. const path = require('path');
  3. function resolve(dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. // If your port is set to 80,
  7. // use administrator privileges to execute the command line.
  8. // For example, Mac: sudo npm run
  9. // You can change the port by the following method:
  10. // port = 9518 npm run dev OR npm run dev --port = 9518
  11. const port = process.env.port || process.env.npm_config_port || 9518; // dev port
  12. // All configuration item explanations can be find in https://cli.vuejs.org/config/
  13. module.exports = {
  14. /**
  15. * You will need to set publicPath if you plan to deploy your site under a sub path,
  16. * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
  17. * then publicPath should be set to "/bar/".
  18. * In most cases please use '/' !!!
  19. * Detail: https://cli.vuejs.org/config/#publicpath
  20. */
  21. // publicPath: '/',
  22. publicPath: './',
  23. outputDir: 'dist',
  24. assetsDir: './static',
  25. lintOnSave: false,
  26. indexPath: './index.html',
  27. productionSourceMap: false,
  28. devServer: {
  29. port: port,
  30. open: true,
  31. overlay: {
  32. warnings: false,
  33. errors: true
  34. },
  35. proxy: {
  36. '/apo': {
  37. target: 'http://localhost:8090',
  38. changeOrigin: true,
  39. pathRewrite: {}
  40. },
  41. '/ws': {
  42. target: 'http://localhost:8090',
  43. ws: true,
  44. changeOrigin: true,
  45. pathRewrite: {
  46. '^/ws' : ''
  47. }
  48. },
  49. },
  50. // before: require('./mock/mock-server.js')
  51. },
  52. transpileDependencies: [/node_modules[/\\\\](element-ui|vuex|vue-baidu-map|)[/\\\\]/], // 默认情况下 babel-loader 会忽略所有 node_modules 中的文件。如果你想要通过 Babel 显式转译一个依赖,可以在 transpileDependencies 选项中列出来。
  53. };