Skip to content

Commit f1e42c8

Browse files
committed
No need to babel transform from rolldown
1 parent 51734f4 commit f1e42c8

File tree

3 files changed

+11
-92
lines changed

3 files changed

+11
-92
lines changed

package-lock.json

Lines changed: 2 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/node-tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"bootstrap": "npm run copy-tests && npm run gyp-to-cmake && npm run build-tests && npm run bundle"
1919
},
2020
"devDependencies": {
21-
"@rollup/plugin-babel": "^6.0.4",
2221
"cmake-js": "^7.3.1",
2322
"cmake-rn": "*",
2423
"gyp-to-cmake": "*",

packages/node-tests/rolldown.config.mts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import path from "node:path";
44

55
import { defineConfig, type RolldownOptions } from "rolldown";
66
import { aliasPlugin, replacePlugin } from "rolldown/experimental";
7-
import { babel } from "@rollup/plugin-babel";
8-
9-
import nodeApiBabelPlugin from "react-native-node-api/babel-plugin";
107

118
function readGypTargetNames(gypFilePath: string): string[] {
129
const contents = JSON.parse(fs.readFileSync(gypFilePath, "utf-8")) as unknown;
@@ -50,24 +47,21 @@ function testBundle(
5047
Object.fromEntries(
5148
targetNames.map((targetName) => [
5249
`require(\`./build/\${common.buildType}/${targetName}\`)`,
53-
`require('./build/Release/${targetName}')`,
50+
`require("./build/Release/${targetName}")`,
5451
])
5552
),
5653
{
5754
delimiters: ["", ""],
5855
}
5956
),
60-
// Use the babel plugin to transform require statements for addons before they get resolved
61-
babel({
62-
babelHelpers: "bundled",
63-
plugins: [nodeApiBabelPlugin],
64-
}),
6557
replacePlugin(
66-
{
67-
// Replace "__require" statement with a regular "require" to allow Metro to resolve it
68-
'__require("react-native-node-api")':
69-
'require("react-native-node-api")',
70-
},
58+
Object.fromEntries(
59+
targetNames.map((targetName) => [
60+
// Replace "__require" statement with a regular "require" to allow Metro to resolve it
61+
`__require("./build/Release/${targetName}")`,
62+
`require("./build/Release/${targetName}")`,
63+
])
64+
),
7165
{
7266
delimiters: ["", ""],
7367
}
@@ -81,7 +75,7 @@ function testBundle(
8175
],
8276
}),
8377
],
84-
external: ["react-native-node-api"],
78+
external: targetNames.map((targetName) => `./build/Release/${targetName}`),
8579
}));
8680
}
8781

0 commit comments

Comments
 (0)