浙里学车工行支付宝生活号支付收银台项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.5 KiB

  1. const CompressionWebpackPlugin = require('compression-webpack-plugin');
  2. const port = process.env.port || process.env.npm_config_port || 9103 // dev port
  3. const productionGzipExtensions = ['js','css','less']
  4. module.exports = {
  5. publicPath: process.env.VUE_APP_PATH,
  6. outputDir: 'dist',
  7. assetsDir: 'static',
  8. productionSourceMap: false,
  9. transpileDependencies: ['vant'], // 需要兼容IE10要放开这个
  10. devServer: {
  11. port: port,
  12. open: true,
  13. host: '0.0.0.0',
  14. overlay: {
  15. warnings: false,
  16. errors: true
  17. },
  18. proxy: {
  19. '/alipayapi': {
  20. target: process.env.VUE_APP_BASE_URL,
  21. changeOrigin: true,
  22. pathRewrite: {
  23. '^/alipayapi': ''
  24. }
  25. }
  26. }
  27. },
  28. chainWebpack: config => {
  29. config.plugin('html').tap(options => {
  30. options[0].title = '浙里学车生活号';
  31. return options;
  32. });
  33. if (process.env.NODE_ENV === 'production') {
  34. config.plugin('compressionPlugin').use(new CompressionWebpackPlugin({
  35. filename: '[path].gz[query]',
  36. algorithm: 'gzip',
  37. test: new RegExp(
  38. '\\.(' +productionGzipExtensions.join('|') +
  39. ')$'
  40. ),
  41. threshold: 10240,
  42. // deleteOriginalAssets:true, //删除源文件,不建议
  43. minRatio: 0.8
  44. }));
  45. }
  46. }
  47. }