-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Vite: The package may have incorrect main/module/exports specified in its package.json #19149
Comments
Removing the "module" property resolves the issue, but I'm not sure if that's the desired approach, since one might not have the control over the library they consume. |
Related to #18492 (comment) |
@barbados-clemens left a comment that makes me very unhappy. This sounds like a breaking change release and not a feature release. It breaks the behaviour that it was before. Especially when migrating should keep everything working. Is there a workaround that doesn't involve changing the behaviour of the npm base repo? |
I will add more, the solution suggested just causes another issue. If you make changes to the lib, this will not trigger a reload of the app or a rebuild of the lib/app. Just makes me wonder why do you support even the npm workspaces. |
I'm getting the same issue using yarn workspaces. |
I think another solution for this is to prevent the migration to use the `import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; Something is missing on this plugin that makes it break. If I still use So the question now is, what does |
Hello @teofilomonteiro I've just found a new solution for this, explained everything in detail here: #21030 TL;DR: you can change the paths alias inside the |
@fsgreco I don't think we can use your solution because we are publishing packages. And from what I understood from your suggestion you need to rename the package. Is that correct? |
Maybe this will help? #18931 (comment) |
@teofilomonteiro actually you can change the strategy and rename the exports instead. The package will still have it's name, but you have to rename the pathname on the Ps: let me know how it goes, it's been a couple of months since I create this issue and found the solution.
|
Closing as duplicate of #20520 Thanks everyone for chiming in here, this is all valuable information |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
I have a library, which can no longer be generated with Webpack, that consumes a custom npm package, and when building it, it fails with the following message
I have also reported it to Vite, but haven't had a chance, as of yet, to create a reproducible example.
At the moment, the library's package.json defines both main and module properties
where the first one's content looks as if it was transpiled for ie5
and the second one for the modern browsers
Expected Behavior
It should work.
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
No response
Package Manager Version
yarn
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: