webdeb / next-styles

CSS + SASS + CssModules in Next.js
40 stars 6 forks source link

compilation error nextjs 10.0.3: options has an unknown property 'onlyLocals' #21

Open JbPons opened 3 years ago

JbPons commented 3 years ago

I try to use the library with nextjs 10.0.3, and I have this error during next dev execution. I check the css-loader releases. I found this:

image

I have also a different issue during build time: ModuleNotFoundError: Module not found: Error: Can't resolve 'css-loader/locals' For this one, i didn't find any solution...

So, Is it possible to update the withStyle.js with the last version of css-loader and nextjs ?

webdeb commented 3 years ago

So, Is it possible to update the withStyle.js with the last version of css-loader and nextjs ?

@JbPons sure, I can't work on it right now, but you are welcome to create a PR.

JbPons commented 3 years ago

@webdeb i didn't have time too. I found the problem for the css-loader/locals'. Basically when you use SSR the withStyles.js try to use the css-loader/locals and this option is depecrated since version 2.0.0 of css-loader.

As a temporary solution I add "resolutions": { "css-loader": "1.0.1" } on my package.json. I take this solution from the issue #17 and I change the proposed workaround with the version 1.0.1 since it's the latest version of css-loader that work with the css-loader/locals.

I hope someone will update the library with the latest breaking change of css-loader