vue.config.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const CompressionWebpackPlugin = require('compression-webpack-plugin'); // 开启压缩
  2. const webpack = require('webpack');
  3. // const isProduction = process.env.NODE_ENV === 'production';
  4. module.exports = {
  5. publicPath: './',
  6. productionSourceMap: false,
  7. devServer: {
  8. port: 8081,
  9. proxy: {
  10. '/test/face': {
  11. target: 'https://facegame.platomix.net',
  12. pathRewrite: {
  13. '^/test/face': '/'
  14. }
  15. },
  16. },
  17. },
  18. pages: {
  19. mobile: {
  20. entry: 'src/mobile.js',
  21. template: 'public/mobile.html',
  22. filename: 'mobile.html'
  23. },
  24. index: {
  25. entry: 'src/main.js',
  26. template: 'public/index.html',
  27. filename: 'index.html'
  28. },
  29. },
  30. chainWebpack: config => {
  31. config.plugins.delete('prefetch')
  32. },
  33. css: {
  34. loaderOptions: {
  35. css: {},
  36. postcss: {
  37. plugins: [
  38. require('postcss-plugin-px2rem')({
  39. rootValue: 75,
  40. exclude: /(node_module)/,
  41. }),
  42. ]
  43. },
  44. sass: {
  45. prependData: `@import "./src/styles/mixin.scss";`
  46. }
  47. }
  48. },
  49. configureWebpack: {
  50. // 服务器也要相应开启gzip
  51. plugins: [
  52. new webpack.optimize.LimitChunkCountPlugin({
  53. maxChunks: 30,
  54. minChunkSize: 1000
  55. })
  56. ]
  57. }
  58. }