The following statement evaluates differently when run in React Dev mode versus
a production optimized build produced by create-react-app
:
/[^\d\-a-z]/iu.exec("a")
-
Clone and navigate to repo:
$ git@github.com:rwoll/repro-create-react-app-regex.git $ cd repro-create-react-app-regex
-
Install dependencies:
$ npm i
-
Launch the app in dev mode:
$ npm start
Observe true
is displayed.
-
Build the production optimized version of the app, and launch on port 4000:
$ npm run build $ npx serve -s build -l tcp://localhost:4000
Observe false
is displayed.
Both cases should be consistent and display true
; however, something as part of
the production build (Terser?) is making the code wrong.
node: v14.7.0
macOS: 10.15.6
chrome: 85.0.4183.102