index.js 1.9KB

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