Skip to content
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

Predictably wrong CSS ordering when sharing components between different component types #75137

Open
kl13nt-tng opened this issue Jan 21, 2025 · 0 comments
Labels
Module Resolution Module resolution (CJS / ESM, module resolving).

Comments

@kl13nt-tng
Copy link

Link to the code that reproduces this issue

https://codesandbox.io/p/live/a657211a-67d2-4c9a-a4bb-f061e9a08dd2

To Reproduce

Next will mess up the ordering of your component styling under the following conditions (combined):

  1. You have some sort of shared component, let's call it "ComponentLayout"
  2. ComponentLayout is used in client, server, statically rendered, and dynamically imported components (basically everywhere)
  3. ComponentLayout allows you to pass in a className to use with its own, allowing you to override its own styling

What is interesting is that it adds preload links in the correct order, but then messes up the actual stylesheet links.

Current vs. Expected behavior

Current:
Observe as Next proceeds to mess up the ordering, leading to SharedLayout's styles overriding some of your components.

Expected:
Next should respect import and loading order regardless of usages.

Provide environment information

All environments running Next>=14.2.0, regardless of OS and browser.

Which area(s) are affected? (Select all that apply)

Module Resolution

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Other (Deployed)

Additional context

No response

@github-actions github-actions bot added the Module Resolution Module resolution (CJS / ESM, module resolving). label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Module Resolution Module resolution (CJS / ESM, module resolving).
Projects
None yet
Development

No branches or pull requests

1 participant