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

next.js css-modules styles omitted from resulting class names #10

Open
vschoettke opened this issue Sep 15, 2021 · 3 comments
Open

next.js css-modules styles omitted from resulting class names #10

vschoettke opened this issue Sep 15, 2021 · 3 comments

Comments

@vschoettke
Copy link

Hi @Mistereo,

when using the built-in css-modules from next.js together with next-linaria the css-modules classnames are stripped away from the final html. (e.g. import styles from "../styles/some.module.css and then use it like className={styles.someClassname}) This was working ok with version 0.10.

Affected Version: 0.11 and 1.0.1-beta

I tracked the problem down to the rules that were added in 0.11 specifically
rule.options.modules.exportOnlyLocals = false
seems to be the problem.

@jantimon
Copy link

I have the very same problem - why do we need exportsOnlyLocals for linaria?

@joyfulelement
Copy link

Encourntered the same issue with v0.11.10. Will encounter runtime error like below:

Warning: Prop `className` did not match. Server: "null" Client: "class_name__9KLlt"
    at div
    at div
    at div
    at div
    at div
    at section
    at render (webpack-internal:///./node_modules/@linaria/react/esm/styled.js:47:13)
    at section
    at render (webpack-internal:///./node_modules/@linaria/react/esm/styled.js:47:13)
    at section
    at render (webpack-internal:///./node_modules/@linaria/react/esm/styled.js:47:13)
    at footer
    at render (webpack-internal:///./node_modules/@linaria/react/esm/styled.js:47:13)

This is a major road block for adopting linaria with Nest.js when built-in css-modules is broken.
It's almost a year since the case has opened, are there any thought about how this can be resolved any time soon?
Thanks

@scowalt
Copy link

scowalt commented Apr 7, 2023

+1. As a workaround, I have a local version of next-linaria that has rule.options.modules.exportOnlyLocals = false; commented out.

This line was added with #5. I wonder if its inclusion is even strictly necessary to fix the bug. If it is, maybe withLinaria could support a configuration that disables this change? If it isn't necessary, perhaps it could just be removed

Repository owner deleted a comment from katsavav Feb 5, 2024
Repository owner deleted a comment from katsavav Feb 5, 2024
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

4 participants