nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.32k stars 267 forks source link

Adding @nuxt/image to my modules causes a RollupError with an unrelated scss file 😶 #1151

Open TimGuendel opened 9 months ago

TimGuendel commented 9 months ago

This is the error:

`[09:47:22] WARN (inject plugin) rollup-plugin-inject: failed to parse C:/dev/frontend-web-2/assets/styles/colors/colors.module.scss. Consider restricting the plugin to particular files via options.include

[nitro 09:47:23] ERROR RollupError: Expression expected (Note that you need plugins to import files that are not JavaScript)

1: @forward 'assets/styles/colors/_colors.scss'; ^

The scsss file (colors.module.scss) only contains this line: @forward 'assets/styles/colors/_colors.scss';

And next to it there is colors.module.scss.d.ts:

declare module '@/assets/styles/colors/colors.module.scss' {
    const stuff = ...
    export default content;
}

I need this because I am accessing the colors in my code, and it used to work just fine. How does adding @nuxt/image break this? 🤔

sahibalejandro commented 2 months ago

@TimGuendel did you find a solution to this?

Seems like @nuxt/image and some other modules breaks Rollup config when they are loaded. This same problem is breaking @prisma/nuxt too. Check this thread: https://github.com/prisma/nuxt-prisma/issues/12

TimGuendel commented 2 months ago

We switched to tailwind and therefore I did not need to access the colors in the code IIRC. I guess we never found out what the problem was 🧐