index.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. const config = {
  2. projectName: 'fish_app',
  3. date: '2024-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: 'dist',
  12. plugins: [],
  13. defineConstants: {
  14. },
  15. copy: {
  16. patterns: [
  17. ],
  18. options: {
  19. }
  20. },
  21. framework: 'react',
  22. compiler: 'webpack4',
  23. mini: {
  24. postcss: {
  25. pxtransform: {
  26. enable: true,
  27. config: {
  28. }
  29. },
  30. url: {
  31. enable: true,
  32. config: {
  33. limit: 1024 // 设定转换尺寸上限
  34. }
  35. },
  36. cssModules: {
  37. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  38. config: {
  39. namingPattern: 'module', // 转换模式,取值为 global/module
  40. generateScopedName: '[name]__[local]___[hash:base64:5]'
  41. }
  42. }
  43. }
  44. },
  45. h5: {
  46. publicPath: '/',
  47. staticDirectory: 'static',
  48. postcss: {
  49. autoprefixer: {
  50. enable: true,
  51. config: {
  52. }
  53. },
  54. cssModules: {
  55. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  56. config: {
  57. namingPattern: 'module', // 转换模式,取值为 global/module
  58. generateScopedName: '[name]__[local]___[hash:base64:5]'
  59. }
  60. }
  61. }
  62. },
  63. rn: {
  64. appName: 'taroDemo',
  65. postcss: {
  66. cssModules: {
  67. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  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. }