canirequire

canirequireCommonJS › react-native

Is react-native ESM-only? Can you require() it?

A framework for building native apps using React

Latest version 0.87.1, published Aug 26, 2026. JSON

CommonJS CommonJS — require() works on every Node.js version

react-native ships CommonJS only. require("react-native") works everywhere. import "react-native" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Latest
0.87.1 (Aug 26, 2026)
Module format
CommonJS
Last CommonJS version
0.87.1
TypeScript types
Bundled
Node engines
^22.13.0 || ^24.3.0 || >= 26.0.0
Weekly downloads
11.9M
License
MIT

Does react-native@0.87.1 actually load? Runtime test results

Runtime probe pending for this version. The values below are what package.json declares; they are refreshed once the probe runs.

Runtimerequire("react-native")import "react-native"
Node.js 18✓ expected✓ expected
Node.js 20✓ expected✓ expected
Node.js 22✓ expected✓ expected
Node.js 24✓ expected✓ expected
Node.js 26✓ expected✓ expected
Bun 1.4pendingpending

Install failed in our sandbox: PROBE_TIMEOUT The rows above show what package.json declares.

How to import react-native

ES modules (import)

import reactNative from "react-native";

Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.

CommonJS (require)

const reactNative = require("react-native");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (381 versions; the newest 60 shown).

VersionsFormatFirst published
0.76.2 – 1000.0.0CommonJSNov 14, 2024

Frequently asked

Is react-native ESM-only?

react-native@0.87.1 is a CommonJS package. react-native ships CommonJS only. require("react-native") works everywhere. import "react-native" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Can I import react-native with ES module syntax?

Yes. import reactNative from "react-native" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

Does react-native ship TypeScript types?

Yes. react-native bundles its own type declarations; no @types package is needed.

Links

Other commonjs packages

Similar popularity