-
Notifications
You must be signed in to change notification settings - Fork 129
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
bug: bun workspace dependencies not resolved #448
Comments
I looked into this and the reason this fails is because when publishing it resolves Most likely, npm workspace specifiers should be changed to a JSR specifier on publish. I opened denoland/deno#23638 As a temporary workaround, I believe adding the following would fix it so that it maps the --- a/packages/nextjs/jsr.json
+++ b/packages/nextjs/jsr.json
@@ -5,6 +5,9 @@
".": "./src/index.ts",
"./presets": "./src/presets.ts"
},
+ "imports": {
+ "@t3-oss/env": "jsr:@t3-oss/env@^0.10.3"
+ },
"include": ["src/**/*.ts", "README.md", "LICENSE", "package.json"],
"exclude": ["node_modules", "dist", "test"]
} |
I managed to publish my library on JSR from bun monorepo |
Same issue here, any update on this? I've tried several possible solution but no one helped. |
Yeah, it's getting closer. As of two days ago we understand npm workspaces so we can identify the other packages in the workspace (this will be in the next Deno minor release next week). An issue in this situation is we don't yet support wildcards in npm workspaces (ex. |
This is now working for me with no changes to the original branch when publishing from the workspace root:
And with |
@dsherret Thanks for the update. I've tried it on my project too. Now the pipeline runs smoothly and all packages are published correctly but unfortunately the imports for the workspace packages in TypeScript files are incorrectly pointing to the package using the jsr specifier. For instance, you can see an example of this issue here Additionally, I've noticed that dependencies marked with In my understanding, shouldn't the I appreciate your guidance on this matter. Thank you very much! |
Isn't that correct for them to be referencing the other JSR package? What's the output you expected?
I think some of those dependencies aren't listed because they're not imported by any export? Do you have an example of the package not working? I just tried importing every export of that package and it seems to work for me. |
Thanks for the quick response. For instance, let's pick the package I sent you above as an example If you check the import at line 1:
This is not valid outside of Deno, I'd expect the following:
If you check the package.json created by the npm layer for So in my package About I hope I have made myself clear, |
Ah wait a second, do you mean that since no one file that has been exported is using it, this is the reason why it is not listed it in the dependencies? Looks like this logic can break this and other packages, I need all the dependencies listed in the package json also if the file that I'm exporting are not using it. I believe I'm now understanding the root cause of the issues with my package, which likely stems from this ticket and the oversight of binary files by JSR. Since the bin script it is not added to the node_modules Upon examining another package that utilizes the same dependency, it is correctly listed in the package.json dependencies within the npm layer. Additionally, while the JSR documentation appears to reference an incorrect file, the import path is accurate in the npm layer. JSR docs NPM layer / node_modules
|
@dsherret, confirming that exporting the script intended for the The main drawback is the necessity to directly reference and execute the script located in the node_modules folder, rather than using a simpler, single-word command in the package.json scripts. But the lib is usable, finally. For reference, the issue related to the .bin directory can be tracked on this ticket: #157 Regarding the limitation of ts files being compatible only with Deno, it seems this will remain the case until other runtimes adopt the prefix:convention as outlined here: https://jsr.io/docs/native-imports. (EDIT: Found this ticket #640) Thanks a lot |
ref t3-oss/t3-env#227 (comment)
when a package depends on a workspace package, jsr fails to resolve that import (at least when using Bun):
@t3-oss/env-core
published successfully, but when going to publish@t3-oss/env-nextjs
it fails with the following error:The text was updated successfully, but these errors were encountered: