Skip to content

getting "@use rules must be written before any other rules" error even though config has hoistUseStatements #150

@patrick99e99

Description

@patrick99e99

I have an icons.scss file which has in it:

@use '~fancy_icons/dist/index' as i;
$icons: i.$icons;
...

And my config has:

loaders.push({
  loader: 'sass-resources-loader',
  options: {
    hoistUseStatements: true,
    resources: [
      'app/javascript/stylesheets/icons.scss',
    ]
  }
});

Yet I still get:

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: @use rules must be written before any other rules.
    ╷
402 │ @use '~fancy_icons/dist/index' as i;
    │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions