index.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const path = require('path')
  2. const config = {
  3. projectName: 'YunShake',
  4. date: '2021-11-26',
  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. alias: {
  17. '@/': path.resolve(__dirname, '..', 'src/'),
  18. '@/components': path.resolve(__dirname, '..', 'src/components'),
  19. '@/hooks': path.resolve(__dirname, '..', 'src/hooks'),
  20. '@/utils': path.resolve(__dirname, '..', 'src/utils'),
  21. },
  22. copy: {
  23. patterns: [
  24. ],
  25. options: {
  26. }
  27. },
  28. framework: 'react',
  29. mini: {
  30. miniCssExtractPluginOption: {
  31. ignoreOrder: true
  32. },
  33. postcss: {
  34. pxtransform: {
  35. enable: true,
  36. config: {
  37. }
  38. },
  39. url: {
  40. enable: true,
  41. config: {
  42. limit: 1024 // 设定转换尺寸上限
  43. }
  44. },
  45. cssModules: {
  46. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  47. config: {
  48. namingPattern: 'module', // 转换模式,取值为 global/module
  49. generateScopedName: '[name]__[local]___[hash:base64:5]'
  50. }
  51. }
  52. }
  53. },
  54. h5: {
  55. publicPath: '/',
  56. staticDirectory: 'static',
  57. postcss: {
  58. autoprefixer: {
  59. enable: true,
  60. config: {
  61. }
  62. },
  63. cssModules: {
  64. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  65. config: {
  66. namingPattern: 'module', // 转换模式,取值为 global/module
  67. generateScopedName: '[name]__[local]___[hash:base64:5]'
  68. }
  69. }
  70. }
  71. }
  72. }
  73. module.exports = function (merge) {
  74. if (process.env.NODE_ENV === 'development') {
  75. return merge({}, config, require('./dev'))
  76. }
  77. return merge({}, config, require('./prod'))
  78. }