What's happening
I have a working Craco 5/React 16/Node14 project (https://github.com/MattGyverLee/prestige) that I'm trying to rebuild in Craco 7/React 18/Node 18 from scratch.
I ran CRA and got a working app. I added a CRACO config and got a working app, then added Electron.
In my old app, I would use this command to start both webpack and the Electron server:
"electron-dev": "env-cmd -f .env.electron concurrently \"craco start --config craco.config.js\" \"wait-on http://localhost:3000 && electron public/electron.js",.
It would simply wait until port 3000 woke up and then start Electron.
Unfortunately, wait-on still never triggered, and I didn't know why. It just sat and waited indefinitely after the server was running until I crashed it:
C:\Github\prestigenext>yarn electron-dev
yarn run v1.22.19
$ env-cmd -f .env.electron concurrently "craco start --config craco.config.js" "wait-on http://localhost:3000 && electron public/electron.js
[0] Starting the development server...
[0]
[0] Compiled successfully!
[0]
[0] You can now view prestige in the browser.
[0]
[0] Local: http://localhost:3000
[0] On Your Network: http://192.168.8.165:3000
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]
[0] webpack compiled successfully
[0] No issues found.
C:\Github\prestigenext>[1] ^C^CTerminate batch job (Y/N)? Terminate batch job (Y/N)? craco start --config craco.config.js exited with code 1
[1] wait-on tcp:3000 && electron public/electron.js exited with code 1
What should happen
Once the deprecation bug is solved with react-scripts, CRACO should probably be updated so that we don't need the devServer workaround.
To reproduce
CREATE a CRA app with CRACO.
Try to start it, and get the deprecation error.
CRACO version
CRACO 7.0.0, 7.0.0-alpha.3 and 7.0.0-alpha.5`.
What's happening I have a working Craco 5/React 16/Node14 project (https://github.com/MattGyverLee/prestige) that I'm trying to rebuild in Craco 7/React 18/Node 18 from scratch. I ran CRA and got a working app. I added a CRACO config and got a working app, then added Electron. In my old app, I would use this command to start both webpack and the Electron server:
"electron-dev": "env-cmd -f .env.electron concurrently \"craco start --config craco.config.js\" \"wait-on http://localhost:3000 && electron public/electron.js",
. It would simply wait until port 3000 woke up and then start Electron.My env.electron on both projects looks like this:
On my new app, I'm using
Initially, I was getting the deprecation warnings shown here: https://github.com/facebook/create-react-app/issues/11860 I understand that these are warnings from react-scripts and not errors, but they cause the wait-on to never trigger. I used this post: https://github.com/facebook/create-react-app/issues/11860#issuecomment-1140417343 and this post: https://github.com/facebook/create-react-app/issues/12035#issuecomment-1238144577 to resolve/hide the warnings (along with testing CRACO
7.0.0
,7.0.0-alpha.3
and 7.0.0-alpha.5`.Unfortunately, wait-on still never triggered, and I didn't know why. It just sat and waited indefinitely after the server was running until I crashed it:
Finally, after writing all this, I tested with my local IP address instead of localhost, and wait-on worked. Then I found this post that offers the workaround of http://127.0.0.1:3000 . https://stackoverflow.com/questions/74448801/react-stuck-at-wait-on-at-localhost3000
What should happen Once the deprecation bug is solved with react-scripts, CRACO should probably be updated so that we don't need the
devServer
workaround.To reproduce
CRACO version CRACO
7.0.0
,7.0.0-alpha.3
and 7.0.0-alpha.5`.CRACO config
package.json
Additional information I realize that this is a sticky incompatibility between CRACO and CRA (with an open issue).