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

JS dependency and async attribute mean racy failures are possible #283

Open
yoavweiss opened this issue Nov 23, 2017 · 1 comment
Open

Comments

@yoavweiss
Copy link

yoavweiss commented Nov 23, 2017

1.js depends on app.js but both are loaded with the async attribute, meaning they can racily fail if app.js takes longer to load and 1.js loads faster.

While copying the new smashing redesign to my own server for testing purposes (I hope that's OK, but wanted to use real content for perf tests of https://chromium-review.googlesource.com/c/chromium/src/+/720798 :D), I got failures of 1.js, indicating that webpackJsonp is not defined. I noticed that in my setup 1.js loads and executes before app.js, resulting in that failure.

While on the production site I didn't see such failures, 1.js could load first if e.g. its host is having a bad day and takes longer to respond.

You could solve this issue by changing these scripts to defer even though that may have implications for IE8 support (I don't know if you actually support IE8). Alternatively, you can preload them, and execute both only after both are preloaded.

- Do you want to request a feature or report a bug?
Bug

- What is the current behavior?
Potential racy failures if app.js is slower than usual.

- If the current behavior is a bug, please provide the steps to reproduce.

- What is the expected behavior?

- Please mention your operating system version and the version of your browser

@vitalyfriedman
Copy link
Collaborator

vitalyfriedman commented Dec 6, 2017

Thanks for reporting it, @yoavweiss — will look into in detail next.

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