index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const config = {
  2. projectName: "wx-csbwg-minapp",
  3. date: "2024-3-28",
  4. designWidth: 750,
  5. deviceRatio: {
  6. 640: 2.34 / 2,
  7. 750: 1,
  8. 828: 1.81 / 2,
  9. },
  10. sourceRoot: "src",
  11. outputRoot: "dist",
  12. plugins: [],
  13. defineConstants: {
  14. "process.env.TARO_APP_API": JSON.stringify(process.env.TARO_APP_API),
  15. },
  16. copy: {
  17. patterns: [],
  18. options: {},
  19. },
  20. framework: "react",
  21. mini: {
  22. postcss: {
  23. pxtransform: {
  24. enable: true,
  25. config: {
  26. mediaQuery: true,
  27. },
  28. },
  29. url: {
  30. enable: true,
  31. config: {
  32. limit: 1024, // 设定转换尺寸上限
  33. },
  34. },
  35. cssModules: {
  36. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  37. config: {
  38. namingPattern: "module", // 转换模式,取值为 global/module
  39. generateScopedName: "[name]__[local]___[hash:base64:5]",
  40. },
  41. },
  42. },
  43. },
  44. h5: {
  45. publicPath: "/",
  46. staticDirectory: "static",
  47. postcss: {
  48. autoprefixer: {
  49. enable: true,
  50. config: {},
  51. },
  52. cssModules: {
  53. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  54. config: {
  55. namingPattern: "module", // 转换模式,取值为 global/module
  56. generateScopedName: "[name]__[local]___[hash:base64:5]",
  57. },
  58. },
  59. },
  60. },
  61. };
  62. module.exports = function (merge) {
  63. if (process.env.NODE_ENV === "development") {
  64. return merge({}, config, require("./dev"));
  65. }
  66. return merge({}, config, require("./prod"));
  67. };