reactjs / react-docgen

A CLI and library to extract information from React component files for documentation generation purposes.
https://react-docgen.dev
MIT License
3.65k stars 295 forks source link

Support for CSS Modules #388

Open kevde opened 5 years ago

kevde commented 5 years ago

Hi guys!

React Scripts already support CSS Modules https://create-react-app.dev/docs/adding-a-css-modules-stylesheet

When I tried creating documentations via react-docgen. This error is displayed:

READING FILE:  D:\workspaces-mobilize\steamfabuilib\src\components\CampaignMarketingForm\CampaignMarketingForm.js
D:\workspaces-mobilize\steamfabuilib\src\components\Styles\emoji-mart.module.css:1
(function (exports, require, module, __filename, __dirname) { .emoji-mart,
                                                              ^

SyntaxError: Unexpected token .

It seems that css treated via CSS Modules is not supported by react-docgen. Can you have feedbacks from it? Thanks

jquense commented 5 years ago

This wouldn't be an issue with react-docgen, unless you are incorrectly trying to parse css files. React-docgen doesn't require any of your files so it would try and parse a dependency of a js file. The only way I think you can get this error is by trying to parse css files