From 7b6e97eeae7100d9b96461b36ddc206c564aa8b8 Mon Sep 17 00:00:00 2001 From: devjiwonchoi Date: Wed, 13 Nov 2024 05:51:32 +0900 Subject: [PATCH] silence sass warning --- crates/next-core/src/next_shared/webpack_rules/sass.rs | 7 ++++++- packages/next/src/build/webpack/config/blocks/css/index.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/next-core/src/next_shared/webpack_rules/sass.rs b/crates/next-core/src/next_shared/webpack_rules/sass.rs index ce18ca0b90b83..da6d47a8e6934 100644 --- a/crates/next-core/src/next_shared/webpack_rules/sass.rs +++ b/crates/next-core/src/next_shared/webpack_rules/sass.rs @@ -12,9 +12,14 @@ pub async fn maybe_add_sass_loader( webpack_rules: Option>, ) -> Result> { 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 { diff --git a/packages/next/src/build/webpack/config/blocks/css/index.ts b/packages/next/src/build/webpack/config/blocks/css/index.ts index 198c35cbf0021..99d3f0117e8d2 100644 --- a/packages/next/src/build/webpack/config/blocks/css/index.ts +++ b/packages/next/src/build/webpack/config/blocks/css/index.ts @@ -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,