Comments (7)
<script defer>
instead of<script async>
on pages that don’t stream HTML
I second this in making this configurable, there should be an option for neither defer or async, where it fetches and executes immediately before the HTML begins the parse.
update: correction to my statement, I actually want neither defer or async, but would like this to be configurable.
from webpack.
@knyto2 i'm curious what the benefit you see to using defer
(even in the non streaming case) over async
?
from webpack.
@DylanPiercey Sorry, I meant that there should be an option to not have either async or defer, where the the javascript will be fetched and executed immediately (which I'm assuming marko is beginning to stream in this case). As a result, the script elements are outside of html. As a workaround, I've added tags to force my component to be rendered inside the desired element. I see that in lasso, it is not loading the scripts async.
Also, shouldn't the CSS come before the JS assets? I am seeing a first paint issue where my components are being rendered, but looks the CSS is still coming over the wire, so it looks like html without the css.
from webpack.
Using async
actually allows the Marko runtime to load immediately, and components initialize as they are streamed out. Script async
does not effect blocking style sheets though, so what you are seeing must be from something else.
If we didn’t use async
that’d mean flushing scripts at the end of the body which would mean they couldn’t be downloaded or evaluated until the entire document is ready. Using defer
has the same issue, but the scripts don’t have to go at the end of the body. Using async
tells the browser to download and execute right away without blocking the pages rendering, which is what the Marko runtime is designed to do.
from webpack.
I'm thinking that the Marko webpack plugin should expose hooks similar to HTMLWebpackPlugin that allow for changing the asset writing code.
from webpack.
Didn’t @mlrawlings have a branch doing pretty much exactly that, or am I misremembering?
from webpack.
I think you are misremembering. We have talked about doing that before though for other reasons.
from webpack.
Related Issues (18)
- Action required: Greenkeeper could not be activated 🚨
- Provide boilerplates / migration guide for lasso users HOT 1
- Uncaught TypeError: out.error is not a function
- package.json "repository" URL 404s HOT 1
- Asset loading strategy problems HOT 2
- Automatically include discovered taglibs when compiling HOT 2
- @marko/webpack is trying to require the package "tslib" without it being listed in its dependencies
- Add CSP nonce to the rendered script HOT 3
- Cannot assign to read only property 'exports' of object '#<Object>' HOT 1
- Cache Marko Files HOT 2
- Incompatible with Webpack 5 HOT 3
- Loader support for split component lazy hydration HOT 1
- Breaks if component filename contains `?`
- Compilation errors starting with 8.0.1 HOT 11
- Maximum call stack size exceeded when component references itself HOT 2
- Marko stopped working after upgrade to 5.31.16 HOT 6
- Support rspack
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack.