index.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require('path')
  2. const config = {
  3. projectName: 'hospitalGN',
  4. date: '2022-5-6',
  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. '@/assets': path.resolve(__dirname, '..', 'src/assets'),
  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. 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: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  43. config: {
  44. namingPattern: 'module', // 转换模式,取值为 global/module
  45. generateScopedName: '[name]__[local]___[hash:base64:5]'
  46. }
  47. }
  48. }
  49. },
  50. h5: {
  51. publicPath: '/',
  52. staticDirectory: 'static',
  53. postcss: {
  54. autoprefixer: {
  55. enable: true,
  56. config: {
  57. }
  58. },
  59. cssModules: {
  60. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  61. config: {
  62. namingPattern: 'module', // 转换模式,取值为 global/module
  63. generateScopedName: '[name]__[local]___[hash:base64:5]'
  64. }
  65. }
  66. }
  67. }
  68. }
  69. module.exports = function (merge) {
  70. if (process.env.NODE_ENV === 'development') {
  71. return merge({}, config, require('./dev'))
  72. }
  73. return merge({}, config, require('./prod'))
  74. }