vue.config.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. const path = require('path');
  2. const menu = require('./mock/menu');
  3. const frameSrc = path.resolve(__dirname);
  4. const baseUrl = '/admin';
  5. module.exports = {
  6. // baseUrl: './',
  7. publicPath: baseUrl, // : process.env.VUE_APP_ROOT_URL,
  8. configureWebpack: {
  9. externals: {
  10. 'element-ui': 'Element',
  11. weui: 'weui',
  12. vue: 'Vue',
  13. },
  14. resolve: {
  15. alias: {
  16. '@frame': frameSrc,
  17. '@naf': path.join(frameSrc, '/naf'),
  18. '@lib': path.join(frameSrc, '/lib'),
  19. },
  20. },
  21. },
  22. devServer: {
  23. port: 3000,
  24. // historyApiFallback: {
  25. // disableDotRule: true,
  26. // rewrites: [
  27. // { from: /^\/$/, to: path.posix.join(baseUrl, 'loading.html') },
  28. // { from: /\/login/, to: path.posix.join(baseUrl, 'login.html') },
  29. // { from: /\/frame/, to: path.posix.join(baseUrl, 'frame.html') },
  30. // { from: /./, to: path.posix.join(baseUrl, '404.html') },
  31. // ],
  32. // },
  33. before(app) {
  34. app.use((req, res, next) => {
  35. console.log(`[${req.method}]`, req.path);
  36. next();
  37. });
  38. app.use('/platform/api', menu);
  39. },
  40. proxy: {
  41. // '/platform/api/docflow': {
  42. // target: 'http://localhost:8301',
  43. // pathRewrite: { '^/platform/api/docflow': '' },
  44. // },
  45. '/platform/api': {
  46. // target: 'http://smart.cc-lotus.info',
  47. target: 'http://smart.localhost:8000',
  48. },
  49. '/ws': {
  50. // target: 'http://smart.cc-lotus.info',
  51. target: 'http://smart.localhost:8000',
  52. ws: true,
  53. },
  54. '/files': {
  55. target: 'http://smart.cc-lotus.info',
  56. },
  57. '/admin/system': {
  58. target: 'http://localhost:3001',
  59. },
  60. '/admin/jobs': {
  61. target: 'http://localhost:3002',
  62. },
  63. '/admin/docflow': {
  64. target: 'http://localhost:3003',
  65. },
  66. },
  67. },
  68. };