I have two webpack bundles, main.js
and vendor.js
. Obviously, the main.js
script has many dependencies inside vendor.js
, and vendor must be loaded first.
Currently, at the end of my html doc, I am just doing:
<script src={assets.javascript.vendor} charSet='UTF-8' />
<script src={assets.javascript.main} async defer charSet='UTF-8' />
This way, at least the main.js
bundle is loaded async. But if I set both bundles to async, pageload will randomly fail depending on the order of download/execution.
Basically every pagespeed tool complains about vendor.js
being "render blocking", even though it's at the very end of my html doc. I don't know how seriously to take this, but is there a way to set both bundles to load async, but ensure execution happens in the right order, without doing stuff like writing script tags from other JavaScript files etc?
This must be a common use case with webpack?