-
Notifications
You must be signed in to change notification settings - Fork 4
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
Asset loading strategy problems #11
Comments
Other than the granular as-it-streams loading, this might be solvable with a <marko-webpack-scripts />
<marko-webpack-styles /> (Names welcome for bikeshedding) By placing them in the root templates, the developer can control where the injection points are, without overly complicating the inject-into-stream logic. Everything under point №1 is no longer a problem. Additionally, the injected elements can be configured with attributes: <marko-webpack-scripts
type="module"
preload=(url => !url.includes('lazy'))
/> This doesn’t solve everything in points №2 and 3, but it would solve many of them. What do you think? |
Problems 1 and 2 have been fixed. 3 adds enough scope it should probably be its own issue. |
Injecting assets before the
<!doctype>
puts the page in Quirks Mode; that’s clearly bad and the team has acknowledged that, so I won’t waste more words on it. Some other possible problems depending on injection point:<meta charset>
<base>
<meta name="referrer-policy">
<meta http-equiv="Content-Security-Policy>
<link>
/<script>
element we see”, or an explicit marker string in the<head>
to.replace()
?Resource loading order is nondeterministic:
<link rel=preload>
is higher-priority than<link rel=stylesheet>
, but since<link rel=preload>
is injected via script, there are race conditions involving:<script>
executes before the lookahead preparser finds the<link>
sThe resource-loading strategy has a lot of thought put into it, but it may not fit all. Some things I wanted to try:
<script type="module">
, such as for sending less heavily-transpiled bundles for newer browsers<link rel=stylesheet>
right before each component for truly progressive renderingnonce
s or Sub-Resource Integrity hashesThe text was updated successfully, but these errors were encountered: