safety-eval-website/jjb.babel.js

31 lines
783 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 开发服务器会注入 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",
}],
],
};