-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
importing .css from node_modules from within a @shared/ui package #122
Comments
Hello there 👋 this is a known limitation, and I would even say it's a feature:
Hope that helps, I understand the frustration, but it's for the best :) |
Thank you, appreciate that. Is there a workaround? I am trying to use the https://rmwc.io/ library in a shared component package. I am looking to ADD next to the existing monorepo. If this was a new project I could just add the component in the /next directory and all would be well. :) |
You can have a look at these two examples depending if you prefer to use
hope that helps! |
Sidenote: if you build your UI library and publish it (in CJS), and consume this UI library via npm or a private package manager, you don't need |
I have a monorepo with several packages. In my
@shared/ui
package I created a Button that uses a 3rd party library which requires importing css from @shared/ui/node_modules.I have been following this issue which fixes importing from node_modules WITHIN the
next/
folder. However my @shared/ui package is a few levels above/next
.I can manually move the Button component into a
next/ui
folder and it works as expected. But not when I import from@shared/ui
. I tried a few other things like linking and modifying tsconfig with paths and usingprojectReferences: false
to no avail, then I stumbled upon this project.If I'm reading it properly it seems like I should be able to just add the basic
next.config.js
example with ["@shared/ui"] and it would work, but unfortunately I run into the same error as before:Global CSS cannot be imported from within node_modules.
Am I missing something? Should this work or is the third party lib from
node_modules
causing more issues with transpile-modules?The text was updated successfully, but these errors were encountered: