rollup-plugin-postcss icon indicating copy to clipboard operation
rollup-plugin-postcss copied to clipboard

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

Open jdannemann opened this issue 3 years ago • 1 comments

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 avatar Feb 23 '23 21:02 jdannemann

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

jdannemann avatar Feb 23 '23 21:02 jdannemann