Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

696
Views
Scss error: @use rules must be written before any other rules

I have React project with scss configuration. When I create simple components with storybook I use global variables with @use "../../assets/styles/constants/_colors". It works well...

But if I import my simple components into the page I got this error: @use rules must be written before any other rules. I use @use at the very top level of the stylesheet.

I am m trying to change webpack configuration, but it doesn`t help me. My webpack style configuration:

 {
      test: /\.(scss|css)$/,
      use: [
        'style-loader',
        MiniCssExtractPlugin.loader,
        'css-loader',
        'postcss-loader',
        'sass-loader',
        {
          loader: 'sass-resources-loader',
          options: {
            resources: require(path.join(__dirname, 'src/assets/styles/shared-scss-code.js')),
          },
        },
      ],
    },

shared-scss-code.js file:

const path = require('path');
const resources = [
  'bootstrap-variables.scss',
  '../../../node_modules/...',
  '../../../node_modules/...',
];
module.exports = resources.map((file) => path.resolve(__dirname, file));

sass-resources-loader option hoistUseStatements don`t help me to fix it.

I hope somebody can help me fix the problem...

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!