Is there any reason to use async instead of defer in script tags here https://github.com/zeit/next.js/blob/canary/packages/next/pages/_document.js ?
Scripts marked defer are executed (after parsing completes) in the order which they are defined in the markup.
Maybe in your case it doesn't matter what to use, but it could be helpful when i.e. you want to load some polyfill before other scripts, you mark it as defer not to block page rendering, but you cannot be sure it will be executed before other scripts, because they are marked async, and they can be executed before the deferred one.
It sounds like an easy change.
What do you think?
Copypasting from loadable-components:
defer would maintain (non extracted from JS) CSS orderdefer would wait for HTML to finish parse before React would try to hydrate into the incomplete treedefer would maintain JS order, but it's, actually, webpack's job - it will _execute_ them.defer would have lower loading priority, so you will have to prefetch the same script to load it prior images and other heavy content.Excellent point about the script order not actually being important. The timing of when webpackJsonp() gets invoked seems like something nobody should be relying on anyway.
Most helpful comment
Copypasting from loadable-components:
deferwould maintain (non extracted from JS) CSS orderdeferwould wait for HTML to finish parse before React would try tohydrateinto the incomplete treedeferwould maintain JS order, but it's, actually,webpack's job - it will _execute_ them.deferwould have lower loading priority, so you will have toprefetchthe same script to load it prior images and other heavy content.