Replies: 1 comment 1 reply
-
+1 to this proposal - @VitorFigm is your custom loader how you're solving for this now? can't find any other docs on this, but having the same issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Make it possible to export a config in
next.config.js
with a property that uses webpack to add the "use client" to client components from a third-party component library and allow server components to import it directly without the need for wrapper files.Non-Goals
No response
Background
To use NextJS 13 with client components libraries like Prime React or React Bootstrap, since they are not exporting their components with the "use client" directive, we need to create a file like this:
Besides that doing this sucks, this, for instance, breaks the VScode auto import extension (it doesn't reach components exported this way).
Proposal
It's easy to use webpack loaders to fix that:
So, one way of implementing that would be having a property in next.config.js that just abstracts this webpack loader. It could be something like this:
and this property will pass this array to the test property of the webpack loader.
Beta Was this translation helpful? Give feedback.
All reactions