-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Next 13 - When running turbo, scss stylesheets are not loaded #42375
Comments
It does not even work without turbo. No styles are applied whatsoever when navigating between pages. Guess css modules are just broken. |
Is this issue resolved? I guess it was a bad decision to use Next 13 at the moment for new projects. But we have noticed that the styles are getting loaded if we use |
Without turbo, I also encounter issues when applying scss on app folder.
Is there any way to trigger Fast Refresh on imported styles? This is not an issue with Next 12 since we load globals on _app.tsx. |
The problem is not specific to scss or css modules. I use tailwind and have the same problem. Its a general problem of imported css files, no matter what generated them: // app/layout.tsx
import "./layout.css" When I change and save the file directly, without changing any of the ts(x) files, next dev compiler detects "a change" and outputs:
So it does track the file correctly as a dependency because it was imported. I checkd the webpack resource URL of the css file directly and its updated there as well. The reason why there is no update on the page is because the style tag does not get reloaded. The browser does not know the file behind the URL has changed, it does not receive any event to reload the css file and hence no recompute & repaint occur. |
I found at least one reason, why css does not reload. Because the author of the issue has a different version than me, it might be two different bugs. I'm using next 13.0.5. I'm pretty sure the following PR in 13.0.5 broke the css reload: When I downgrade to 13.0.4 reload on css update works again. The PR has removed the timestamp from the css file and so the url never changes and the browser does not reload it. Maybe some of the people here, especially those transpiling from scss have the same issue? |
Hey, Jordan from the Tailwind Labs team here. We've done some investgating of this issue ourselves and want to share our findings:
I've created a minimal reproduction with Tailwind CSS that you can take a look at. |
@thecrypticace looks like what I'v observed and suspected. No update event and prior to removal of the timestamps in 13.0.5 from the CSS files, the bug was unnoticed because the refresh was triggered by browser reloading the file as the URL changed. I wonder: Since the output css does change and its imported on a route (tsx) shouldn't it be tracked by HMR for changes as it is a dependency of the tsx file? |
I was having issues with tailwind styles to load as well, just fixed it by upgrading to [email protected] |
Guys, any news about? |
Guys, problem solved in version 13.4.1 |
Am using Next 13.4.1 and getting this error when using Turbo |
|
I have the same issue. SCSS modules are not loaded on SSR. When i do 'use client' to my components then the styles are there. Also for the components that Im loading directly into the Layout file, styles are working on SSR and on Client Side. I have tried everything. Downgrade from 13.4.3 to 13.4.1, install postscss, loaders and I dont know what to do. |
Same issue in SassError: SassError: Can't find stylesheet to import.
╷
1 │ @import "Auth.scss"; |
Fully Reproduce Repo
Tested on |
Not related to Next itself, but I hope it'll help the next dev landing on this discussion: as silly as it sounds, my issue was that I had somehow set an override for the CSS files. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
Describe the Bug
Scss modules do not appear to be loading under the new turbo
The style import always returns undefined.
Expected Behavior
Style is loaded and the red background css is present on the div.test element.
Link to reproduction
used npx-create-next-app
To Reproduce
When creating a new project from following command:
npx create-next-app@latest --experimental-app
And updating dev script to inlclude the turbo flag
"dev": "next dev --turbo",
Also loaded npm package "sass" as per instruction
When creating a very basic scss file: (./test.module.scss) in the app directory
.test { background-color: red; }
And creating an page.js file in app directory
`
import styles from './test.module.scss';
const Home = () => {
};
export default Home;
`
The text was updated successfully, but these errors were encountered: