index.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const config = {
  2. projectName: 'mxplugin',
  3. date: '2023-11-13',
  4. designWidth: 750,
  5. deviceRatio: {
  6. '640': 2.34 / 2,
  7. '750': 1,
  8. '828': 1.81 / 2
  9. },
  10. sourceRoot: 'src',
  11. outputRoot: 'miniprogram',
  12. plugins: [],
  13. copy: {
  14. patterns: [
  15. ],
  16. options: {
  17. }
  18. },
  19. framework: 'react',
  20. compiler: 'webpack5',
  21. cache: {
  22. enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
  23. },
  24. defineConstants: {
  25. },
  26. mini: {
  27. postcss: {
  28. autoprefixer: {
  29. enable: true,
  30. config: {
  31. }
  32. },
  33. pxtransform: {
  34. enable: true,
  35. config: {
  36. }
  37. },
  38. url: {
  39. enable: true,
  40. config: {
  41. limit: 10240 // 设定转换尺寸上限
  42. }
  43. },
  44. cssModules: {
  45. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  46. config: {
  47. namingPattern: 'module', // 转换模式,取值为 global/module
  48. generateScopedName: '[name]__[local]___[hash:base64:5]'
  49. }
  50. }
  51. }
  52. },
  53. h5: {
  54. publicPath: '/',
  55. staticDirectory: 'static',
  56. postcss: {
  57. autoprefixer: {
  58. enable: true,
  59. config: {
  60. }
  61. },
  62. cssModules: {
  63. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  64. config: {
  65. namingPattern: 'module', // 转换模式,取值为 global/module
  66. generateScopedName: '[name]__[local]___[hash:base64:5]'
  67. }
  68. }
  69. }
  70. }
  71. }
  72. module.exports = function (merge) {
  73. if (process.env.NODE_ENV === 'development') {
  74. return merge({}, config, require('./dev'))
  75. }
  76. return merge({}, config, require('./prod'))
  77. }