Describe the bug
The JavaScript/ES2020 native BigInt is not available in the latest create-react-app on Node 20, but
node -e 'console.log(BigInt(42))'
correctly outputs 42n
but npm start or yarn start fail with an error
'BigInt' is not defined no-undef
Did you try recovering your dependencies?
There are no dependencies other than the originally added/installed by create-react-app
Which terms did you search for in User Guide?
- BigInt
- BigInt react is not defined
- BigInt yarn v1 is not defined
- BigInt npm yarn node 20
- react-scripts BigInt is not defined
- create-react-app bigint support
- BigInt browser compatibility
- BigInt node requirements
- BigInt ES2020
- jsconfig es2020
Environment
Environment Info:
current version of create-react-app: 5.0.1
running from /usr/local/lib/node_modules/create-react-app
System:
OS: Linux 5.10 Alpine Linux
CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
Binaries:
Node: 20.4.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.8.1 - /usr/local/bin/npm
Browsers:
Chrome: Not Found
npmPackages:
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
react-scripts: 5.0.1 => 5.0.1
npmGlobalPackages:
create-react-app: 5.0.1
Steps to reproduce
-
Create a new node 20 docker container
docker run --rm -it --entrypoint sh node:20-alpine
-
Install git, nano, and create-react-app in the container (I dislike using vim)
# apk add git nano
# npm install -g create-react-app
-
Create a new react app
npx create-react-app bigint
-
Add BigInt into the index.js code
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
console.log(BigInt(42));
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
- Save
index.js
- Run
npm start or yarn start
Failed to compile.
[eslint]
src/index.js
Line 7:13: 'BigInt' is not defined no-undef
Search for the keywords to learn more about each error.
ERROR in [eslint]
src/index.js
Line 7:13: 'BigInt' is not defined no-undef
Search for the keywords to learn more about each error.
webpack compiled with 1 error
Expected behavior
The compilation should not failed and the development server should start. Upon loading http://localhost:3000 (by default) the browser console should have an etry for 42n
Actual behavior

Reproducible demo
https://codesandbox.io/s/react-bigint-undefined-3mmh66?file=/src/App.js
Describe the bug
The JavaScript/ES2020 native
BigIntis not available in the latestcreate-react-appon Node 20, butnode -e 'console.log(BigInt(42))'correctly outputs
42nbut
npm startoryarn startfail with an errorDid you try recovering your dependencies?
There are no dependencies other than the originally added/installed by
create-react-appWhich terms did you search for in User Guide?
Environment
Steps to reproduce
Create a new node 20 docker container
docker run --rm -it --entrypoint sh node:20-alpineInstall git, nano, and
create-react-appin the container (I dislike usingvim)Create a new react app
npx create-react-app bigintAdd
BigIntinto theindex.jscodeindex.jsnpm startoryarn startExpected behavior
The compilation should not failed and the development server should start. Upon loading http://localhost:3000 (by default) the browser console should have an etry for
42nActual behavior
Reproducible demo
https://codesandbox.io/s/react-bigint-undefined-3mmh66?file=/src/App.js