index.ts 1.8 KB

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