You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
CRACO config
constfs=require("fs");constNodePolyfillPlugin=require("node-polyfill-webpack-plugin");constevalSourceMap=require("react-dev-utils/evalSourceMapMiddleware");constredirectServedPath=require("react-dev-utils/redirectServedPathMiddleware");constnoopServiceWorker=require("react-dev-utils/noopServiceWorkerMiddleware");module.exports={webpack: {plugins: {add: [newNodePolyfillPlugin({excludeAliases: ["console"],}),],},},devServer: (devServerConfig,{ env, paths })=>{devServerConfig={onBeforeSetupMiddleware: undefined,onAfterSetupMiddleware: undefined,setupMiddlewares: (middlewares,devServer)=>{if(!devServer){thrownewError("webpack-dev-server is not defined");}if(fs.existsSync(paths.proxySetup)){require(paths.proxySetup)(devServer.app);}middlewares.push(evalSourceMap(devServer),redirectServedPath(paths.publicUrlOrPath),noopServiceWorker(paths.publicUrlOrPath));returnmiddlewares;},};returndevServerConfig;},};
MattGyverLee
changed the title
Craco+Electron+wait-on fails to trigger because of Deprecation warning in CRA.
Craco+CRA strows middleware deprecation warnings from CRA.
Feb 24, 2023
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:
facebook/create-react-app#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:
facebook/create-react-app#11860 (comment)
and this post:
facebook/create-react-app#12035 (comment)
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).
The text was updated successfully, but these errors were encountered: