import { UnifiedWebpackPluginV5 } from "weapp-tailwindcss/webpack"; const config = { projectName: "game-discuz", date: "2025-9-2", designWidth: 375, deviceRatio: { 640: 2.34 / 2, 750: 1, 828: 1.81 / 2, 375: 2 / 1, }, sourceRoot: "src", outputRoot: "dist", plugins: ["@tarojs/plugin-html"], defineConstants: {}, copy: { patterns: [], options: {}, }, framework: "react", compiler: { type: "webpack5", prebundle: { enable: false }, }, mini: { webpackChain(chain, webpack) { chain.merge({ plugin: { install: { plugin: UnifiedWebpackPluginV5, args: [ { appType: "taro", // 下面个配置,会开启 rem -> rpx 的转化 // rem2rpx: true, injectAdditionalCssVarScope: true, }, ], }, }, }); }, postcss: { pxtransform: { enable: true, config: { selectorBlackList: ["nut-"], }, }, url: { enable: true, config: { limit: 1024, // 设定转换尺寸上限 }, }, cssModules: { enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true config: { namingPattern: "module", // 转换模式,取值为 global/module generateScopedName: "[name]__[local]___[hash:base64:5]", }, }, }, }, h5: { publicPath: "/", staticDirectory: "static", // esnextModules: ['nutui-react'], postcss: { pxtransform: { enable: true, config: { selectorBlackList: ["nut-"], // removeCursorStyle: false, }, }, autoprefixer: { enable: true, config: {}, }, cssModules: { enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true config: { namingPattern: "module", // 转换模式,取值为 global/module generateScopedName: "[name]__[local]___[hash:base64:5]", }, }, }, }, }; module.exports = function (merge) { if (process.env.NODE_ENV === "development") { return merge({}, config, require("./dev")); } return merge({}, config, require("./prod")); };