next.js: Next 15 update throws deprecation warning in console using sass
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/dark-architecture-go8s7s
To Reproduce
- install
sass(yarn add -D sass) - import styles from a SCSS module file
- Update Next to v15.0.0
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 59
- Comments: 25 (8 by maintainers)
Commits related to this issue
- Make Sass stop yelling while Next finishes upgrading it to the new API SEE https://sass-lang.com/documentation/breaking-changes/legacy-js-api/ SEE https://github.com/vercel/next.js/issues/71638 — committed to ravinggenius/minecraft-tools by ravinggenius 2 years ago
- silence sass `legacy-js-api` warning (#72632) ### Why? This PR silences `legacy-js-api` warning enabled from PR https://github.com/vercel/next.js/pull/70067 by updating the `sass-loader` to v15.... — committed to vercel/next.js by devjiwonchoi 2 years ago
- silence the warning error about sass https://github.com/vercel/next.js/issues/71638 — committed to jenfrani/FretboardVisualizer by deleted user 2 years ago
- Make Sass stop yelling while Next finishes upgrading it to the new API SEE https://sass-lang.com/documentation/breaking-changes/legacy-js-api/ SEE https://github.com/vercel/next.js/issues/71638 — committed to ravinggenius/minecraft-tools by ravinggenius 2 years ago
- Silence deprecation warning To be fixed by next.js, see https://github.com/vercel/next.js/issues/71638 — committed to jorins/jorin.se by jorins 2 years ago
- fix: silence saas legacy-js-api deprecation reference: https://sass-lang.com/documentation/breaking-changes/legacy-js-api/ reference: https://github.com/vercel/next.js/issues/71638 — committed to techwithanirudh/shadcn-portfolio by techwithanirudh 2 years ago
- Update to next.js 15 and react 19 beta - Fix and update types, especially for useParallax - Use react compiler - Use latest motion alpha which fixes some types regarding className - Use turbopack in ... — committed to joonassandell/portfolio by joonassandell 2 years ago
- fix: sass legacy api warning (https://github.com/vercel/next.js/issues/71638) — committed to qzqzcsclub/journal-site by NriotHrreion 2 years ago
- fix(turbo): sassOptions `silenceDeprecations` was not overwritten with user options (#73937) ### Why? The user's `silenceDeprecations` option was not overwritten in turbopack, only the `legacy-js... — committed to vercel/next.js by devjiwonchoi 2 years ago
- fix(turbo): sassOptions `silenceDeprecations` was not overwritten with user options (#73937) ### Why? The user's `silenceDeprecations` option was not overwritten in turbopack, only the `legacy-js... — committed to vercel/next.js by devjiwonchoi 2 years ago
@alfarodarwaynejay I believe you can use next config if you want to silence these warnings :
cf. https://nextjs.org/docs/app/building-your-application/styling/sass and https://sass-lang.com/documentation/breaking-changes/legacy-js-api/#silencing-warnings
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?
gotta love open source 🙄
@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 everyone, thank you for waiting! Silencing the warning was added at PR https://github.com/vercel/next.js/pull/72632, and released to canary in v15.0.4-canary.12, and will be added to the next release!
If, like me, you did this but the warnings keep getting printed out when running
next dev, remove the.nextdirectory and it’ll fix it.@tr1s an experimental option will allow people to opt-in to the new Sass API, which may require users to update their
sassOptionsat the same timeUpgrading it by default would require everyone to update their
sassOptions, and might break their builds before they do so—so “upgrade it by default” would be a breaking change that can only be made in a semver-major release@devjiwonchoi I came across a regression with your PR. When Turbo is enabled, other silenceDeprecations options from next config are ignored. My guess is that your Rust changes do not account for an existing array, but replaces silenceDeprecations with an array holding only [‘legacy-js-api’].
The webpack implementation seems fine though.
This is my temporary solution:
sass-loadernext.config.js:Important! This is not compatible with Turbopack, I’m not using it.
@JosipPardon This is unrelated to this issue
The error messages are demoralising despite turning the page on Harris.
We started getting this warning today too when trying out Next 15.
Looks like PR https://github.com/vercel/next.js/pull/70067 updated
sass-loaderto a version that is new enough to throw the deprecation warning, but didn’t fully upgrade to v16 that would default to the modern Sass JS API.I believe next updating
sass-loaderto v16+ would fix this. Our projects seem to work fine locally with themodern-compileroption turned on.should be fixed in 15.1 😃 closing
Also,
:export { ... }inwhatever.module.scssdoes not work anymore.I have
home-styles.module.scss:But when running
npm run dev, I get this error:EDIT: this is because turbopack does not support
:export(more here: https://nextjs.org/docs/architecture/turbopack#unsupported-features). Solution is to remove “–turbopack” after “next dev”The SASS team even mentioned this already themself; https://github.com/vercel/next.js/discussions/67931