sveltejs / rollup-plugin-svelte

Compile Svelte components with Rollup
MIT License
505 stars 79 forks source link

[!] Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript) error introduced with version 7.0.0 #165

Closed jordan112 closed 3 years ago

jordan112 commented 3 years ago

I'm currently using version 6.1.1 and it works fine. When I install 7.0.0, I get the following error.

src/main.js → public/build, public/build/nomodule...
[!] Error: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
src/shared/layout/Page.css (1:0)

I'm not clear what the issue is and I'm not able to locate any issues in my code that would cause this issue.

I've tested this out with a vanilla rollup.config and I get the same issue.

jordan112 commented 3 years ago

This appears to relate the this setting

    // Emit CSS as "files" for other plugins to process. default is true
      emitCss: false,

By default, it's true, but if I set it to false, it builds fine with no error

Conduitry commented 3 years ago

As described in the readme, you need another plugin to handle the CSS as of v7.

jordan112 commented 3 years ago

Thank you @Conduitry. I had read the readme but I wasn't clear on that part. I'm able to add

postcss({
      plugins: []
    }),

and it works fine now. FYI for any future devs.

lukeed commented 3 years ago

It's also in the Changelog FYI