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

client javascript doesn't reload the page if there's a build-time error on first load #1316

Closed
1 of 2 tasks
hexpunk opened this issue Feb 23, 2018 · 4 comments
Closed
1 of 2 tasks

Comments

@hexpunk
Copy link
Contributor

hexpunk commented Feb 23, 2018

  • Operating System: MacOS High Sierra, Ubuntu 16.04
  • Node Version: 8.9.4
  • NPM Version: 5.6.0
  • webpack Version: 3.11.0
  • webpack-dev-server Version: 2.11.1
  • This is a bug
  • This is a modification request

Code

I've made a repository that minimally recreates this issue. JayAndCatchFire/minimal-wds-bug-example

Expected Behavior

Scenario 1

  1. The user's code being packed with webpack has a build-time error in it.
  2. The user starts webpack-dev-server and navigates to the app in their browser. The app doesn't fully load due to the build-time error.
  3. The build-time error in the user's code is corrected and webpack successfully rebuilds the bundle.
  4. Webpack-dev-server should reload the app page with the newly built code.

Scenario 2

  1. The user has been running webpack-dev-server for a bit and introduces a code change in their code that includes a build-time error.
  2. The user navigates to their app in a browser with a fresh tab at this point or manually hard-reloads the page at this point. The app doesn't fully load due to the build-time error.
  3. The build-time error in the user's code is corrected and webpack successfully rebuilds the bundle.
  4. Webpack-dev-server should reload the app page with the newly built code.

Actual Behavior

In both of the above scenarios, the fourth step doesn't occur. The page remains in a broken state.

For Bugs; How can we reproduce the behavior?

The steps outlined in the scenarios above should outline how to reproduce the bug reliably, although I give more detailed instructions in the README file in my example repository.

@hexpunk
Copy link
Contributor Author

hexpunk commented Feb 23, 2018

I believe the reason this is happening is because of the initial variable in the client source. I suspect it's the culprit because if you correct the client code that's causing a built-time error, reintroduce the erroneous code, and then remove it a second time, the app will be reloaded as expected.

@hexpunk hexpunk mentioned this issue Feb 23, 2018
5 tasks
@SpaceK33z
Copy link
Member

Hey I'm working on this right now and looking through your issue and PR, and I just want to say: THANK YOU for looking into this so extensively and making an example repo. I'm going through it to first reproduce your bug and then test your fix.

@hexpunk
Copy link
Contributor Author

hexpunk commented Feb 25, 2018

You're very welcome. I'd really love to add some unit tests to my PR, but the client code doesn't seem to have any tests that I could find. I'd love any help or guidance you could give me as to the best way to unit test that code.

@SpaceK33z
Copy link
Member

Yeah there are no unit tests for the client code (yet). If you want to help setup tests for the client code that would be welcome though, I see two ways to tackle this:

  • Switch to the Jest test runner and run the client code through its fake DOM.
  • Let the tests start a Puppeteer (headless Chrome) instance, connect to it and run the client code tests in the headless browser.

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

No branches or pull requests

2 participants