Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

698
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda