prod.ts 1.2 KB

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