index.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const path = require('path');
  2. const config = {
  3. projectName: 'civilized-miniapp',
  4. date: '2022-12-12',
  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. },
  16. copy: {
  17. patterns: [
  18. { from: 'src/assets/tabbar/', to: 'dist/assets/tabbar/' },
  19. ],
  20. options: {
  21. }
  22. },
  23. framework: 'react',
  24. compiler: 'webpack4',
  25. alias: {
  26. '@': path.resolve(__dirname, '..', 'src'),
  27. },
  28. mini: {
  29. postcss: {
  30. pxtransform: {
  31. enable: true,
  32. config: {
  33. }
  34. },
  35. url: {
  36. enable: true,
  37. config: {
  38. limit: 1024 // 设定转换尺寸上限
  39. }
  40. },
  41. cssModules: {
  42. enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
  43. config: {
  44. namingPattern: 'module', // 转换模式,取值为 global/module
  45. generateScopedName: '[name]__[local]___[hash:base64:5]'
  46. }
  47. }
  48. }
  49. },
  50. }
  51. module.exports = function (merge) {
  52. if (process.env.NODE_ENV === 'development') {
  53. return merge({}, config, require('./dev'))
  54. }
  55. return merge({}, config, require('./prod'))
  56. }