Skip to content

Commit

Permalink
silence sass legacy-js-api warning (#72632)
Browse files Browse the repository at this point in the history
### Why?

This PR silences `legacy-js-api` warning enabled from PR
#70067 by updating the
`sass-loader` to v15. Will follow up with adding an option to enable the
sass-loader v16 by PR #72423.

x-ref: #71638
  • Loading branch information
devjiwonchoi authored Nov 14, 2024
1 parent 35c7355 commit 0cbc079
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/next-core/src/next_shared/webpack_rules/sass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ pub async fn maybe_add_sass_loader(
webpack_rules: Option<Vc<WebpackRules>>,
) -> Result<Vc<OptionWebpackRules>> {
let sass_options = sass_options.await?;
let Some(sass_options) = sass_options.as_object() else {
let Some(mut sass_options) = sass_options.as_object().cloned() else {
bail!("sass_options must be an object");
};
// TODO: Remove this once we upgrade to sass-loader 16
sass_options.insert(
"silenceDeprecations".into(),
serde_json::json!(["legacy-js-api"]),
);
let mut rules = if let Some(webpack_rules) = webpack_rules {
webpack_rules.await?.clone_value()
} else {
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/build/webpack/config/blocks/css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ export const css = curry(async function css(
// Since it's optional and not required, we'll disable it by default
// to avoid the confusion.
fibers: false,
// TODO: Remove this once we upgrade to sass-loader 16
silenceDeprecations: ['legacy-js-api'],
...sassOptions,
},
additionalData: sassPrependData || sassAdditionalData,
Expand Down

0 comments on commit 0cbc079

Please sign in to comment.