Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown "@use rules must be written before any other rules." #443

Open
jdannemann opened this issue Feb 23, 2023 · 1 comment
Open

Comments

@jdannemann
Copy link

jdannemann commented Feb 23, 2023

I am attempting to add the autoprefixer plugin, but I get a build error, "@use rules must be written before any other rules.".

Here is my rollup config:

module.exports = options => ({
  ...options,
  plugins :[
    scss({
      failOnError: false,
      processor :() => postcss({
        plugins: [
          autoprefixer()
        ],
      }),
    }),
    ...options.plugins,
  ],
});

After setting a breakpoint, it appears the offending code is here. This block combines all the stylesheets into one and does not consider that @use statements must appear in the file's header.

      // Combine all stylesheets
      let scss = ''
      for (const id in styles) {
        scss += styles[id] || ''
      }
@jdannemann
Copy link
Author

Please delete this. I opened the issue in the wrong repo. This is supposed to be an issue for the rollup-plugin-scss repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant