vue.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const path = require('path');
  2. const frameSrc = path.resolve(__dirname);
  3. const baseUrl = '/admin/';
  4. // 导入compression-webpack-plugin
  5. const CompressionWebpackPlugin = require('compression-webpack-plugin');
  6. // 定义压缩文件类型
  7. const productionGzipExtensions = ['js', 'css'];
  8. module.exports = {
  9. publicPath: baseUrl,
  10. outputDir: path.join(frameSrc, '../../admin-web'),
  11. productionSourceMap: false,
  12. configureWebpack: {
  13. resolve: {
  14. alias: {
  15. '@components': path.join(frameSrc, '/src/components'),
  16. '@style': path.join(frameSrc, '/style'),
  17. '@lib': path.join(frameSrc, '/lib'),
  18. '@mock': path.join(frameSrc, '/mock')
  19. }
  20. },
  21. plugins: [
  22. new CompressionWebpackPlugin({
  23. filename: '[path].gz[query]',
  24. algorithm: 'gzip',
  25. test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
  26. threshold: 10240,
  27. minRatio: 0.8
  28. })
  29. ]
  30. },
  31. devServer: {
  32. port: 3000,
  33. proxy: {
  34. '/api/': {
  35. // target: 'http://skl.cc-lotus.info'
  36. target: 'http://127.0.0.1:18090'
  37. },
  38. '/upload/': {
  39. // target: 'http://127.0.0.1:9002'
  40. target: 'http://skl.cc-lotus.info'
  41. }
  42. }
  43. }
  44. };