| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- 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"));
- };
|