@@ -4,9 +4,6 @@ import path from "node:path";
44
55import { defineConfig , type RolldownOptions } from "rolldown" ;
66import { aliasPlugin , replacePlugin } from "rolldown/experimental" ;
7- import { babel } from "@rollup/plugin-babel" ;
8-
9- import nodeApiBabelPlugin from "react-native-node-api/babel-plugin" ;
107
118function 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