Chunk css is inserted before bundle on production, inconsistent with dev environment
See original GitHub issueSteps to reproduce
- Use some css in the bundle
- Create a lazy loading chunk with some css in it
- Navigate to the page that loads the chunk
Expected Behavior
In production environment, I expect both csses to be in the same order as in dev environment - chunk after bundle.
Actual Behavior
- In development
<style>
element of the chunk will be injected after the bundle css - In production
<link>
element of the chunk will be inserted before the bundle css (chunk in head, bundle before</body>
)
Conversation in Slack with prateekbh
ohh i guess i know whats happening bundle is placed by. us at the end of the body where as chunks are inserted by webpack at runtime in headtag
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Chunk css is inserted before bundle on production ... - GitHub
In production environment, I expect both csses to be in the same order as in dev environment - chunk after bundle. Actual Behavior....
Read more >The css style is not the same in development environment and ...
I think this is a problem of order of CSS definition. The development and production CSS definition order might be different.
Read more >How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >API - esbuild
To join a set of files together with esbuild, import them all into a single entry point file and bundle just that one...
Read more >Output - webpack
The top-level output key contains a set of options instructing webpack on how and where it should output your bundles, assets, and anything...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah this makes sense. We need to adjust where we are injecting the prerendered chunks. Maybe we could just set
inject:'body'
here? https://github.com/preactjs/preact-cli/blob/605c965de7da96e974ded1aa511b747b06e1c5a3/packages/cli/lib/lib/webpack/render-html-plugin.js#L71makes sense, also this will make everything a lot more intuitive i agree