index.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. '@/utils': path.resolve(__dirname, '..', 'src/utils'),
  20. },
  21. copy: {
  22. patterns: [
  23. ],
  24. options: {
  25. }
  26. },
  27. framework: 'react',
  28. mini: {
  29. miniCssExtractPluginOption: {
  30. ignoreOrder: true
  31. },
  32. postcss: {
  33. pxtransform: {
  34. enable: true,
  35. config: {
  36. }
  37. },
  38. url: {
  39. enable: true,
  40. config: {
  41. limit: 1024 // 设定转换尺寸上限
  42. }
  43. },
  44. cssModules: {
  45. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  46. config: {
  47. namingPattern: 'module', // 转换模式,取值为 global/module
  48. generateScopedName: '[name]__[local]___[hash:base64:5]'
  49. }
  50. }
  51. }
  52. },
  53. h5: {
  54. publicPath: '/',
  55. staticDirectory: 'static',
  56. postcss: {
  57. autoprefixer: {
  58. enable: true,
  59. config: {
  60. }
  61. },
  62. cssModules: {
  63. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  64. config: {
  65. namingPattern: 'module', // 转换模式,取值为 global/module
  66. generateScopedName: '[name]__[local]___[hash:base64:5]'
  67. }
  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. }