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