-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Closed
Description
Describe the bug
I have an error below:
index.js:8 Uncaught ReferenceError: process is not defined
at Object../node_modules/chalk/index.js (index.js:8)
at __webpack_require__ (bootstrap:734)
at fn (bootstrap:100)
at Object../node_modules/react-dev-utils/formatWebpackMessages.js (formatWebpackMessages.js:10)
at __webpack_require__ (bootstrap:734)
at fn (bootstrap:100)
at Object../node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/ErrorOverlayEntry.js (ErrorOverlayEntry.js:5)
at __webpack_require__ (bootstrap:734)
at fn (bootstrap:100)
at Object.0 (index.tsx:12)
It's caused by a deep dependency of my app, but I deduced the right place to correct this may be here.
I'm not using CRA directly, and running this in an electron app that has sandboxed access to a subset of nodejs API.
Environment
react-dev-utils9.1.0;masterin the repo currently has the same behavior.webpack4,babel7 and so on, but this is irrelevant as workarounds won't cover my use case.
Expected behavior
I expect react-dev-utils/formatWebpackMessages.js to not use chalk, since it's not used in the cli context. chalk requires Node APIs to be available.
Actual behavior
I got an exception. cause chalk has const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');. It's not adopted for browser use.
Reproducible demo
Sorry.
silverwind, monken and saravanan10393