23 lines
732 B
JavaScript
23 lines
732 B
JavaScript
module.exports = {
|
|
presets: [
|
|
["@babel/preset-env", { targets: { node: "current" } }],
|
|
["@babel/preset-react", { runtime: "automatic" }],
|
|
"@babel/preset-typescript",
|
|
],
|
|
plugins: [
|
|
function () {
|
|
return {
|
|
visitor: {
|
|
MetaProperty(path) {
|
|
if (path.node.meta.name === "import" && path.node.property.name === "meta") {
|
|
path.replaceWithSourceString(
|
|
"(typeof global.importMeta !== 'undefined' ? global.importMeta : { env: {} })"
|
|
);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
},
|
|
],
|
|
}
|