index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. const path = require('path') // eslint-disable-line
  2. const config = {
  3. projectName: 'zsdwx3',
  4. date: '2020-12-16',
  5. designWidth: 750,
  6. deviceRatio: {
  7. 640: 2.34 / 2,
  8. 750: 1,
  9. 828: 1.81 / 2,
  10. },
  11. sourceRoot: 'src',
  12. outputRoot: 'dist',
  13. plugins: [],
  14. defineConstants: {},
  15. copy: {
  16. patterns: [
  17. {
  18. from: 'src/loc2.png',
  19. to: 'dist/static/loc2.png',
  20. },
  21. {
  22. from: 'src/static/nav',
  23. to: 'dist/static/nav',
  24. },
  25. {
  26. from: 'src/components/Nearby/nearby',
  27. to: 'dist/components/Nearby/nearby',
  28. },
  29. {
  30. from: 'src/static/wxs/sidebar.wxs',
  31. to: 'dist/pages/index/sidebar.wxs',
  32. },
  33. {
  34. from: 'src/static/images/pose.png',
  35. to: 'dist/static/images/pose.png',
  36. },
  37. {
  38. from: 'src/static/images/sec.png',
  39. to: 'dist/static/images/sec.png',
  40. },
  41. {
  42. from: 'src/static/images/sectop.png',
  43. to: 'dist/static/images/sectop.png',
  44. },
  45. {
  46. from: 'src/static/images/secbrand.png',
  47. to: 'dist/static/images/secbrand.png',
  48. },
  49. {
  50. from: 'src/static/images/poseaudio.png',
  51. to: 'dist/static/images/poseaudio.png',
  52. },
  53. {
  54. from: 'src/static/images/poseaudio.png',
  55. to: 'dist/static/images/posevisual.png',
  56. },
  57. {
  58. from: 'src/static/ect',
  59. to: 'dist/static/ect',
  60. },
  61. { from: 'src/components/vant/wxs', to: 'dist/components/vant/wxs' },
  62. {
  63. from: 'src/components/vant/common/style',
  64. to: 'dist/components/vant/common/style',
  65. },
  66. {
  67. from: 'src/components/vant/common/index.wxss',
  68. to: 'dist/components/vant/common/index.wxss',
  69. },
  70. {
  71. from: 'src/components/vant/sticky/index.wxs',
  72. to: 'dist/components/vant/sticky/index.wxs',
  73. },
  74. ],
  75. options: {},
  76. },
  77. framework: 'react',
  78. alias: {
  79. '@': path.resolve(__dirname, '..', 'src'),
  80. '@vant': path.resolve(__dirname, '..', 'src/components/vant'),
  81. },
  82. mini: {
  83. postcss: {
  84. pxtransform: {
  85. enable: true,
  86. config: {
  87. selectorBlackList: [/van-/],
  88. },
  89. },
  90. url: {
  91. enable: true,
  92. config: {
  93. limit: 1024, // 设定转换尺寸上限
  94. },
  95. },
  96. cssModules: {
  97. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  98. config: {
  99. namingPattern: 'module', // 转换模式,取值为 global/module
  100. generateScopedName: '[name]__[local]___[hash:base64:5]',
  101. },
  102. },
  103. },
  104. },
  105. h5: {
  106. publicPath: '/',
  107. staticDirectory: 'static',
  108. postcss: {
  109. autoprefixer: {
  110. enable: true,
  111. config: {},
  112. },
  113. cssModules: {
  114. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  115. config: {
  116. namingPattern: 'module', // 转换模式,取值为 global/module
  117. generateScopedName: '[name]__[local]___[hash:base64:5]',
  118. },
  119. },
  120. },
  121. },
  122. }
  123. module.exports = function (merge) {
  124. if (process.env.NODE_ENV === 'development') {
  125. return merge({}, config, require('./dev'))
  126. } else if (process.env.NODE_ENV === 'uat') {
  127. return merge({}, config, require('./uat'))
  128. }
  129. return merge({}, config, require('./prod'))
  130. }