prod.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. module.exports = {
  2. env: {
  3. NODE_ENV: '"production"'
  4. },
  5. defineConstants: {
  6. },
  7. h5: {
  8. /**
  9. * WebpackChain 插件配置
  10. * @docs https://github.com/neutrinojs/webpack-chain
  11. */
  12. // webpackChain (chain) {
  13. // /**
  14. // * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
  15. // * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
  16. // */
  17. // chain.plugin('analyzer')
  18. // .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
  19. // /**
  20. // * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
  21. // * @docs https://github.com/chrisvfritz/prerender-spa-plugin
  22. // */
  23. // const path = require('path')
  24. // const Prerender = require('prerender-spa-plugin')
  25. // const staticDir = path.join(__dirname, '..', 'dist')
  26. // chain
  27. // .plugin('prerender')
  28. // .use(new Prerender({
  29. // staticDir,
  30. // routes: [ '/pages/index/index' ],
  31. // postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
  32. // }))
  33. // }
  34. }
  35. }