You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pnpm docs:dev will start the docs in dev mode (with Turbopack enabled). Open the URL http://localhost:3000/preview-card and you'll see that the Size 1, Size 2 etc text is underlined and has a color.
Right click on the Size 1 text and goto Inspect to inspect the element in devtools. On the right, you'll see text-decoration-line and color properties applied with relevant values. Clicking the Layer components will show the layer order as theme, base, components, utilities and tokens.
Prod mode
pnpm docs:build will build the app with Webpack.
pnpm docs:start will start the built app. Goto the same url http://localhost:3000/preview-card. You'll see that the Size 1, Size 2 etc text now not underlined and the color is black.
Right click on the Size 1 text and goto Inspect to inspect the element in devtools. On the right, clicking the Layer base will show the layer order as tokens, components, theme, base and utilities.
Issue
In dev mode, the css order is as expected, which is declared in docs/src/app/layout.tsx. First test-package/index.css is imported which has an explicit layer order defined and then local ./reset.css is imported.
In prod mode, its not the same case. Looking at the built files in browser, the order is
and test-package/index.css seems to be imported at the end. So the css layer order gets defined implicitly as and when components get imported.
Current vs. Expected behavior
In dev mode, the css order is as expected, which is declared in docs/src/app/layout.tsx. First test-package/index.css is imported which has an explicit layer order defined and then local ./reset.css is imported.
In prod mode, its not the same case. Looking at the built files in browser, the order is
Uh oh!
There was an error while loading. Please reload this page.
Link to the code that reproduces this issue
https://github.com/brijeshb42/nextjs-css-order-repro
To Reproduce
TLDR: The import order of css files changes between dev (with Turbpack) and prod (without Turbopack).
Setup
git clone https://github.com/brijeshb42/nextjs-css-order-repro.git
pnpm install
Dev mode
pnpm docs:dev
will start the docs in dev mode (with Turbopack enabled). Open the URL http://localhost:3000/preview-card and you'll see that theSize 1
,Size 2
etc text is underlined and has a color.Size 1
text and gotoInspect
to inspect the element in devtools. On the right, you'll seetext-decoration-line
andcolor
properties applied with relevant values. Clicking the Layercomponents
will show the layer order astheme
,base
,components
,utilities
andtokens
.Prod mode
pnpm docs:build
will build the app with Webpack.pnpm docs:start
will start the built app. Goto the same url http://localhost:3000/preview-card. You'll see that theSize 1
,Size 2
etc text now not underlined and the color is black.Size 1
text and gotoInspect
to inspect the element in devtools. On the right, clicking the Layerbase
will show the layer order astokens
,components
,theme
,base
andutilities
.Issue
In dev mode, the css order is as expected, which is declared in docs/src/app/layout.tsx. First
test-package/index.css
is imported which has an explicit layer order defined and then local ./reset.css is imported.In prod mode, its not the same case. Looking at the built files in browser, the order is
and
test-package/index.css
seems to be imported at the end. So the css layer order gets defined implicitly as and when components get imported.Current vs. Expected behavior
In dev mode, the css order is as expected, which is declared in docs/src/app/layout.tsx. First
test-package/index.css
is imported which has an explicit layer order defined and then local ./reset.css is imported.In prod mode, its not the same case. Looking at the built files in browser, the order is
and
test-package/index.css
seems to be imported at the end. So the css layer order gets defined implicitly as and when components get imported.Provide environment information
Which area(s) are affected? (Select all that apply)
Turbopack, Webpack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: