-
Notifications
You must be signed in to change notification settings - Fork 26.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
Sass @use statements don't work #11610
Comments
Update: it looks like (with that modified
And I've verified that those stylesheets are indeed there in the
|
@nicholaschiang I have usually imported stylesheets from node modules by appending
|
Hey @jonathansamines that would be But this is happening when the stylesheets that I'm using are |
Just FYI I just cloned this Sass example and added a basic That resulted in exactly the same error as seen above. Because of this IMO Next.js cannot say it has built-in Sass support. This is a real blocker for our development workflows. It'd be nice to have more detailed documentation on how you "support it" out-of-box. |
Actually, after a deeper dive into #11063 it looks like I implemented my configuration incorrectly (you guys seriously have to work on your documentation). This const path = require('path');
module.exports = {
experimental: {
sassOptions: {
includePaths: [path.resolve(__dirname, 'node_modules')],
},
},
}; I'm going to keep this issue open but now I'm only asking for improved documentation for how to use/enable experimental features. You should also consider adding documentation to your website for such experimental features so that developers don't have to spend days searching through old issues, discussions, and PRs. |
@nicholaschiang, hello! I think, that to use SASS and CSS options, you need the following code:
It works for me and resolves my absolute imports for local folders within the BUT: I have problems with CSS import ordering in production. Found similar issues, and I'm trying to resolve this problem. |
Yup, @iksent it seems like you're using the old plugin that's no longer needed for Sass support; Next.js now has built-in Sass support (see my previous comments for more info). |
Yes, that's true. |
For anyone else that's trying to use this with dart sass' js implementation for things like
You'll then need to import your scss files in |
Closing this as it was addressed a while ago. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
A clear and concise description of what the bug is.
In my
global.scss
file that is imported bysrc/pages/_app.tsx
:Those
@use
statements fail however because the defaultsass-loader
cannot find those stylesheets:This would make sense, but I also included the
node_modules
directory where the imported stylesheets reside to ournext.config.js
(using the recently implemented fix):And it still doesn't work.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npm i
npm run dev
ornpx next
Expected behavior
A clear and concise description of what you expected to happen.
The
sass-loader
used by Next.js should know to look in ournode_modules
folder for those stylesheets.System information
^9.3.4
v12.16.1
Additional context
Add any other context about the problem here.
You should also work on making this documentation more clear that Next.js has built-in support for Sass (see this issue for more info).
The text was updated successfully, but these errors were encountered: