-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Support workspaces without workspace:
protocol
#4676
Comments
@raulfdm I had the same problem, but have discovered a workaround / partial solution?
The second step seems to be critical - if you don't, bun will instead give the following error (which does seem like a bug):
EDIT: Seems I celebrated too soon. Whilst the installation works, bun can't resolve / import "@monorepo/math" at runtime
EDIT 2: Ah. That's because in your example, the "@monorepo/math" package has an invalid config. It's looking for a file called "index.ts" in the package root but there isn't one
|
Thanks for the inputs @benvan . I've fixed the entry point in the demo repository. Indeed, switching from |
the docs are misleading, checkout issue oven-sh/bun#4676
Yep! Switching to workspace protocol fixed it. I wonder if the docs are either wrong or I missed a step. Either way, hope somebody from the team helps. |
@
) nameworkspace:
protocol
Is switching from A good first approach for us could be to still run the app with node, but start running the unit tests with bun, but I think that this will not be possible unless the package.json syntax is compatible. |
I created a PR to update the docs: #5379 |
Shouldn't the issue be resolved to not need the workspace prefix instead. Better to fix the issue then alter the docs for the workaround? Or is it supposed to need the workspace prefix? I know there were some other issue after adding the prefix. It helped to resolve the dependencies to get it running but everything doesn't work with the prefix either. Had some issue with another command not liking the prefix when I tried it in our monorepo. |
This bug was fixed in Bun v1.1.8: ❯ rm -rf node_modules ../../node_modules/ ../../bun.lockb
❯ bun-1.1.8 install
bun install v1.1.8 (89d25807)
+ @monorepo/math@workspace:packages/math
+ vite-project@workspace:apps/vite-project
+ bun-types@1.0.1 (v1.1.18 available)
+ typescript@5.2.2 (v5.5.3 available)
84 packages installed [360.00ms]
Blocked 1 postinstall. Run `bun pm untrusted` for details. Bun v1.1.7 (where it did not work): ❯ rm -rf node_modules ../../node_modules/ ../../bun.lockb
❯ bun-1.1.7 install
bun install v1.1.7 (b0b7db5c)
🔍 @monorepo/math [1/1]
error: package "@monorepo/math" not found registry.npmjs.org/@monorepo%2fmath 404
error: @monorepo/math@* failed to resolve We've released 10 updates to Bun since Bun v1.1.8 and we've continued to make several improvements to workspaces support in Let us know if you're still running into issues like this and we'll be happy to fix things. |
@Jarred-Sumner thank you so much. Can confirm the problem is fixed :) |
All credit to @dylan-conway :), I did almost nothing |
But is the requirement to use workspace: prefix still present today? Like others said I'm looking for package.json compatability and would just like to hear context about why it's needed. Even with adding the prefix and changing imports I had issues moving a node project to Bun in July and would like to try again now... just wondering what may have improved on this front |
@csmikle I have a project with multiple workspaces, the only mention of them is in the root package.json where I declare the globs. The sub-projects seem to resolve inter-project dependencies just fine even with semver ranges or an asterisk. My LSP even hops to definitions in the correct source files rather than to something in the node_modules. |
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Darwin 23.0.0 arm64 arm
What steps can reproduce the bug?
While trying to migrate to bun workspace, I noticed that
bun
isn't able to resolve internal packages that contain organization alias.Repository: https://github.com/devraul/bun-workspace-organization-error
Steps to reproduce:
bun install --yarn
Notice that this only happens because I have
@monorepo
in the package name.If you remove
@monorepo
and run the installation command, it will work fine.What is the expected behavior?
Resolves the internal package with organization scope in its name.
What do you see instead?
CleanShot.2023-09-09.at.10.54.22.mp4
Additional information
Maybe related #4628
The text was updated successfully, but these errors were encountered: