diff --git a/packages/realm/index.react-native.js b/packages/realm/index.react-native.js index aba7d1bf3a..2a1b1b35d8 100644 --- a/packages/realm/index.react-native.js +++ b/packages/realm/index.react-native.js @@ -19,19 +19,4 @@ /* eslint-disable @typescript-eslint/no-var-requires -- We're exporting using CJS assignment */ /* eslint-env commonjs */ -// eslint-disable-next-line no-undef -- In React Native, process is not defined, but in Jest it is -const isJest = process?.env?.JEST_WORKER_ID !== undefined; - -let entryPoint; - -if (isJest) { - // Define a require function that will load the node bundle - // otherwise, metro will preemptively load the node bundle - const nodeRequire = require; - // Jest is running, use the node bundle - entryPoint = nodeRequire("./dist/bundle.node"); -} else { - entryPoint = require("./dist/bundle.react-native"); -} - -module.exports = entryPoint.Realm; +module.exports = require("./dist/bundle.react-native").Realm; diff --git a/packages/realm/package.json b/packages/realm/package.json index bc6653bca9..1684f58649 100644 --- a/packages/realm/package.json +++ b/packages/realm/package.json @@ -29,6 +29,7 @@ ".": { "types": "./types.d.cts", "node": "./index.node.js", + "require": "./index.node.js", "react-native": "./index.react-native.js" }, "./scripts/submit-analytics": "./scripts/submit-analytics.mjs",