theKashey / used-styles

📝All the critical styles you've used to render a page.
MIT License
137 stars 9 forks source link

React 18 (WebPack 5) doesn't work #41

Closed vladles closed 2 years ago

vladles commented 2 years ago

Critical ERROR Failed to compile.

theKashey commented 2 years ago

Vlad, with all respect, this is not how you can report an issue.


So actually this issue is similar to https://github.com/theKashey/used-styles/issues/40 and the root cause that current implementation of used-styles expects nodejs environment - like some packages exists and it can read files.

Long story short - if this error occurs at your SSR bundle (and used-styles cannot work for not SSR-cases by definition) - and you need to build that bundle with node as a compilation target - https://webpack.js.org/concepts/targets/#usage