vue.config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const CompressionWebpackPlugin = require('compression-webpack-plugin'); // 开启压缩
  2. // const isProduction = process.env.NODE_ENV === 'production';
  3. module.exports = {
  4. publicPath: './',
  5. productionSourceMap: false,
  6. devServer: {
  7. port: 8081,
  8. proxy: {
  9. '/test/face': {
  10. target: 'https://facegame.platomix.net',
  11. pathRewrite: {
  12. '^/test/face': '/'
  13. }
  14. }
  15. },
  16. },
  17. pages: {
  18. mobile: {
  19. entry: 'src/mobile.js',
  20. template: 'public/mobile.html',
  21. filename: 'mobile.html'
  22. },
  23. index: {
  24. entry: 'src/main.js',
  25. template: 'public/index.html',
  26. filename: 'index.html'
  27. },
  28. },
  29. chainWebpack: config => {
  30. config.plugins.delete('prefetch')
  31. },
  32. css: {
  33. loaderOptions: {
  34. css: {},
  35. postcss: {
  36. plugins: [
  37. require('postcss-plugin-px2rem')({
  38. rootValue: 75,
  39. exclude: /(node_module)/,
  40. }),
  41. ]
  42. },
  43. sass: {
  44. prependData: `@import "./src/styles/mixin.scss";`
  45. }
  46. }
  47. },
  48. // configureWebpack: config => {
  49. // const plugins = [];
  50. // // 服务器也要相应开启gzip
  51. // plugins.push(
  52. // new CompressionWebpackPlugin({
  53. // algorithm: 'gzip',
  54. // test: /\.(js|css)$/, // 匹配文件名
  55. // threshold: 10000, // 对超过10k的数据压缩
  56. // deleteOriginalAssets: false, // 不删除源文件
  57. // minRatio: 0.8 // 压缩比
  58. // })
  59. // )
  60. // return {
  61. // plugins
  62. // }
  63. // }
  64. }