Cannot generate library with the @nx/react generator and rspack as a bundler #28442
Replies: 5 comments
-
The React Library Generator does not currently have rspack and option for bundler. If your library is only going to be used internally in your workspace then you do not need to specify a bundler at all, and it will be bundled when the application is bundled. |
Beta Was this translation helpful? Give feedback.
-
Actually, I'm migrating some libraries from a current NX repository to another one in order to expose them to others projects. Moreover the new repository will just have a showcase application in order to show how to use those libraries so It will be helpful to use the @nx/react generator with the rspack configuration. I wanted to test rspack because this application will use the module federation feature and I already have been struggle with the webpack implementation. And by the way, I was just following the @nx/rspack documentation. So if I follow what you say, the documentation is wrong. |
Beta Was this translation helpful? Give feedback.
-
@guitarooman14 Indeed, the rspack documentation is incorrect. I'll update that to be correct. The application can still use rspack and the libraries can use any bundler or no bundler. When you say expose the libraries to other projects, do you mean via an npm package or via a Module Federation remote? |
Beta Was this translation helpful? Give feedback.
-
I need to expose them via an npm package. |
Beta Was this translation helpful? Give feedback.
-
In that case, you can use Thanks for raising this! |
Beta Was this translation helpful? Give feedback.
-
Current Behavior
I was just following the new Rspack documentation to migrate my current project from Webpack to Rspack and I tried to create a new library with the following command provided by this doc (Using @nx/rspack) :
nx g @nx/react:lib my-lib --bundler=rspack
And this is what I got :
Expected Behavior
The new library or application should be created and configure to use the rspack bundler.
GitHub Repo
No response
Steps to Reproduce
For a fresh new install
Nx Report
Node : 20.11.1
OS : win32-x64
Native Target : x86_64-windows
npm : 10.5.2
nx (global) : 20.0.0
nx : 20.0.0
@nx/js : 20.0.0
@nx/jest : 20.0.0
@nx/eslint : 20.0.0
@nx/workspace : 20.0.0
@nx/devkit : 20.0.0
@nx/eslint-plugin : 20.0.0
@nx/react : 20.0.0
@nx/rspack : 20.0.0
@nx/web : 20.0.0
typescript : 5.5.4
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
Failure Logs
No response
Package Manager Version
10.5.2
Operating System
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions