-
Notifications
You must be signed in to change notification settings - Fork 27k
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 15 update throws deprecation warning in console using sass #71638
Comments
We started getting this warning today too when trying out Next 15. Looks like PR #70067 updated I believe next updating |
The SASS team even mentioned this already themself; #67931 |
Hello, is there any way to just suppress the warning for the meantime? |
@alfarodarwaynejay I believe you can use next config if you want to silence these warnings : const nextConfig: NextConfig = {
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
}
} cf. https://nextjs.org/docs/app/building-your-application/styling/sass and https://sass-lang.com/documentation/breaking-changes/legacy-js-api/#silencing-warnings |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
@JosipPardon This is unrelated to this issue |
This comment was marked as off-topic.
This comment was marked as off-topic.
@emdagon That article is also about an unrelated deprecation This issue is about Next’s webpack config loading the “legacy JS API” instead of the “modern JS API” |
Hey, thanks for opening the issue. I'm considering:
We won't be able to upgrade it by default since it would require yet another major. Does that sound like a good compromise? |
Yeaaah buddy |
@feedthejim what are the implications of using an "experimental option to use the upgraded sass" vs "upgrade it by default"? |
@tr1s an experimental option will allow people to opt-in to the new Sass API, which may require users to update their Upgrading it by default would require everyone to update their |
@feedthejim love the idea, thanks 🙏 |
This comment was marked as spam.
This comment was marked as spam.
This is my temporary solution:
/**
* Webpack config modification adopted from https://github.com/vercel/next.js/issues/11629
*/
const regexEqual = (x, y) => {
return (
x instanceof RegExp &&
y instanceof RegExp &&
x.source === y.source &&
x.global === y.global &&
x.ignoreCase === y.ignoreCase &&
x.multiline === y.multiline
)
}
module.exports = {
webpack: config => {
const oneOf = config.module.rules.find(
rule => typeof rule.oneOf === 'object'
)
if (oneOf) {
const sassRule = oneOf.oneOf.find(rule => regexEqual(rule.test, /\.module\.(scss|sass)$/))
if (sassRule) {
const sassLoader = sassRule.use.find(
el => el.loader.includes('next/dist/compiled/sass-loader')
)
if (sassLoader) {
sassLoader.loader = 'sass-loader'
}
}
}
return config
}
} Important! This is not compatible with Turbopack, I'm not using it. |
thank but my case not work |
This comment was marked as off-topic.
This comment was marked as off-topic.
To be fixed by next.js, see vercel/next.js#71638
If, like me, you did this but the warnings keep getting printed out when running |
- Fix and update types, especially for useParallax - Use react compiler - Use latest motion alpha which fixes some types regarding className - Use turbopack in dev - next.config.mjs -> next.config.ts and remove all mjs related "hacks" - Silence sass legacy api errors Related issues and sources - https://nextjs.org/docs/app/api-reference/next-config-js/turbo - vercel/next.js#71638 - vercel/turborepo#4832 - motiondivision/motion#2843
I have installed |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/dark-architecture-go8s7s
To Reproduce
sass
(yarn add -D sass
)Current vs. Expected behavior
A deprecation warning appears from sass : "Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0".
Is the deprecation related to a Next.js deprecated use of .scss modules that will be fixed ? Or does that mean that scss modules is deprecated in Next.js ?
Provide environment information
Operating System: Platform: macOS Version: 14.7 Binaries: Node: 22.10.0 yarn: 1.22.19 Packages: next: 15.0.0 sass: 1.80.1 Next.js Config: reactStrictMode: true, images: { unoptimized: true }
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: