Next.js Discord

Discord Forum

Dart Sass in Next JS issues

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Avatar
Masai LionOP
Started a new project today and I am having issue with Dart Sass.

My error is…
More info: https://sass-lang.com/d/legacy-js-api

Import trace for requested module:
./src/assets/scss/base/brand.scss.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[11].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[11].use[3]!./node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[13].oneOf[11].use[4]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[13].oneOf[11].use[5]!./src/assets/scss/base/brand.scss
./src/assets/scss/base/brand.scss

./src/assets/scss/base/header.scss.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[11].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[11].use[3]!./node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[13].oneOf[11].use[4]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[13].oneOf[11].use[5]!./src/assets/scss/base/header.scss
Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

I'm using the latest version of Sass…
  "dependencies": {
    "next": "15.0.1",
    "sass": "^1.80.4",
    "sass-loader": "^16.0.2"
  }

And docs suggest my next.config.js should contain…
/** @type {import('next').NextConfig} */
const nextConfig = {
    sassOptions: {
        includePaths: ['./src/assets/scss']
    }
};

module.exports = nextConfig;

header.scss mentioned above is
@use '../../../config/colour';

header {
  background-color: colour.$navy;
}

and brand.scss has straight scss, doesn't use @use

As far as I'm aware, I'm using the most up-to-date sass and methods for calling variables?

0 Replies