Create-react-app: Could you add how to use css-modules with CRA into the readme?

Created on 3 Jul 2018  路  6Comments  路  Source: facebook/create-react-app

Trying to figure out how to use css-modules with CRA, all I find is a Dan's tweet saying it can now, pointing to a pull request. I tried, but failed.
https://codesandbox.io/s/vyzlpplnzy

Most helpful comment

This shouldn't be closed as there is no documentation on using CSS modules in create-react-app. Is there plans to document this feature at some point?

All 6 comments

It works fine locally, it's a code-sandbox problem. I've downloaded your code and just did a yarn start. Also, you seem to be using an older build. Consider switching to a newer one.
https://github.com/facebook/create-react-app/issues/3815

@bugzpodder Thanks, by older build do you mean my syntax outdated, or codesandbox using an old version of react-scripts?

I meant older release of create-react-app (although css modules still works using it) that was referenced in code-sandbox, ie in your link it was using 2.0.0-next.b2fd8db8.
code-sandbox just doesn't seem to likee it even when I switched to the latest version.

Cool, glad to know it works and the problem is from codesandbox. I'm closing this. Thank you.

This shouldn't be closed as there is no documentation on using CSS modules in create-react-app. Is there plans to document this feature at some point?

Once create-react-app 2.0 is released. The documentation currently does not include CSS modules so not to confuse users on 1.14

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akctba picture akctba  路  80Comments

razvan-soare picture razvan-soare  路  161Comments

andreypopp picture andreypopp  路  96Comments

riceyeh picture riceyeh  路  116Comments

sgriffey picture sgriffey  路  113Comments