-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Closed
Labels
Description
Feature request
Allow importing CSS modules from other NPM packages.
Is your feature request related to a problem? Please describe.
An NPM package is the primitive of code sharing. Therefore monorepo is very common to split the domain into separate NPM packages. It feels very wrong when we can't import React components.
It should be possible to import CSS files from packages that follow the CSS modules convention *.module.(css|scss)
because Next.js ensures already that CSS Modules are side-effect free.
The current solution forces me:
- Handle my private packages as "global-CSS"
- Pre-compile all my components to not have a CSS import statement.
Current error:
error - ./node_modules/react-modern-calendar/dist/esm/components/Calendar/index.module.css
CSS Modules cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-modules-npm
Additional context
Next.js: 9.4.2
catsheue, arshaw, FilipaBarroso, goloroden, tkmcmaster and 157 morenategiraudeau, normdoow, Davidmnj91 and VityaSchelnandorojo, danielbarion, nategiraudeau, normdoow, perkinsjr and 3 morenategiraudeau, normdoow, Simba14, perkinsjr, Davidmnj91 and 3 morealexandre-marchina, dteferreira, soosap, sandcastle, Tadjo and 6 more