-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Question: how to easily specify a file as "critical" #352
Comments
@heygrady Don't think it is scope of this plugin, it is optimization and you need other plugin for this action, a lot of developers use difference technologies and extracting critical styles can be very difference, we don't have one good solution. Using comments unnecessary you can use |
Thanks. Being able to define a chunk ad hoc would be useful for critical styles regardless of the implementation. I believe that manually adding splitChunks entries as you suggested would be cumbersome for a large app. SSR is probably out of scope but client-side chunking should be in scope. |
@heygrady using comments may be a bit uncomfortable, you can markup new block in header and previously comment will be wrong because it can became not critical, i don't think here exists right solution |
CLosing due output scope this plugin and no generic solution, maybe we can revisit it late. Feel free to feedback. Thanks for issue. |
Related: #53
From what I understand, I can do critical style loading by adding a
data-href
:We have been using
isomorphic-style-loader
to manage critical styles. It allows us to bubble up the styles during SSR and concat them to a string. This isn't ideal withmini-css-extract-plugin
because it can lead to issues with style duplication and style ordering.We are considering how to proceed and it seems there is a gap. With the old
isomorphic-style-loader
setup our critical styles would only be the content of the files we consider "critical".I'm imagining a fork of
isomorphic-style-loader
that sends the src path ofbutton.css
as well as the contents so that we can properly decorate our<style>
tag... but that's where things go wrong. I would be able to use a custom manifest file to look up the src path to figure out which css chunk holds button cssbutton.css
but that chunk will likely hold other non-critical css as well.idea: magic comments to specify chunking.
https://webpack.js.org/api/module-methods/#magic-comments
The text was updated successfully, but these errors were encountered: