question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chunk css is inserted before bundle on production, inconsistent with dev environment

See original GitHub issue

Steps to reproduce

  1. Use some css in the bundle
  2. Create a lazy loading chunk with some css in it
  3. 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

  1. In development <style> element of the chunk will be injected after the bundle css
  2. In production <link> element of the chunk will be inserted before the bundle css (chunk in head, bundle before </body>)
Screen Shot 2020-04-02 at 14 37 51

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:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
developitcommented, Apr 2, 2020

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#L71

0reactions
prateekbhcommented, May 12, 2020

makes sense, also this will make everything a lot more intuitive i agree

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found