Changes the start script to tap on the done and failed hooks of the c… #5268
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do:
Where should the reviewer start:
packages/react-scripts/scripts/start.jswas modified, more specifically thedevServer.listen()callback.What is this trying to solve:
yarn startthe server boots up, opens the browser, but renders a blank page (with the<script>tags properly injected.yarn buildandserve -s build, which I was unable to. That led me to think that the problem was between the dev server or bundle compilationnode_modules/react-scripts/scripts/start.js, in the same area I've changed for this PR, but placing only asetTimeout(() => openBrowser(urls.localUrlForBrowser), 5000);... That solved it - but looked hackish... Led to the obvious question of "What if bundling would take more than X seconds set in the timeout? Not cool"...doneorfailedhooks on the compiler.openBrowseralready checks that.Let me know your thoughts on this and how can I improve it, or if it's something that I shouldn't be doing. I'm all for learning more about it 👍