Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knowing when dev compile is done #3905

Open
robdonn opened this issue Jan 23, 2018 · 4 comments
Open

Knowing when dev compile is done #3905

robdonn opened this issue Jan 23, 2018 · 4 comments

Comments

@robdonn
Copy link

robdonn commented Jan 23, 2018

Is this a bug report?

No

How to tell when webpack dev compile is ready?

I want to be able to run a second process after the dev server is up and running and the compile is done, e.g. run a mock api server. Normally the webpack compiler emits a 'done' event that you can hook into and start a new process or do something else. With CRA, the compiler object is hidden away in the start script.

Is there any way of accessing this event without ejecting?

@gaearon
Copy link
Contributor

gaearon commented Jan 23, 2018

Why do you need to wait? They could both run concurrently.

@robdonn
Copy link
Author

robdonn commented Jan 23, 2018

Hey @gaearon , it's for running acceptance tests.

I have a prepush hook that:

  1. Lints
  2. Unit tests
  3. Spins up the Dev Server
  4. Starts the mock api server
  5. Runs the acceptance/E2E tests

The acceptance tests (I'm using protractor) need the compilation to be complete before they start.

When I eject I can get access to the compiler events but I'm working on a setup that doesn't allow me to eject. So I'm using react-app-rewire to make modifications to the configurations but I'm trying to figure out a way to hook into the compiler events.

@gaearon
Copy link
Contributor

gaearon commented Jan 23, 2018

You can request http://localhost:3000 and start the tests when you get the first response. Would that not work?

@robdonn
Copy link
Author

robdonn commented Jan 23, 2018

@gaearon That's a brilliant idea. I feel stupid for not thinking of it, it's actually how I check that my mock api server is running.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants