// 开发服务器会注入 react-refresh/babel,该插件要求 Babel 环境为 development。 // serve:production 需保持 NODE_ENV=production 以加载 jjb.config 生产配置,此处仅修正 Babel 编译环境。 const lifecycle = process.env.npm_lifecycle_event || ""; if ((lifecycle === "serve" || lifecycle.startsWith("serve:")) && process.env.NODE_ENV === "production") { process.env.BABEL_ENV = "development"; } module.exports = { compact: false, // 插件 plugins: [ [ "@babel/plugin-proposal-decorators", { legacy: true, }, ], ], // 预设 presets: [ ["@babel/preset-env", { targets: { browsers: ["ie >= 10"], }, }], ["@babel/preset-react", { runtime: "automatic", }], ], };