oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.88k stars 2.56k forks source link

Dependencies hoisting #5795

Open websorokinweb opened 9 months ago

websorokinweb commented 9 months ago

What is the problem this feature would solve?

Hello, are you going to support dependencies hoisting? I have project structure like this one

What I want (currently it works with npm and yarn):

  1. To have all my dependencies only in root package.json
  2. To write "bun install" or whatever in root, which will prepare all my packages from /packages to use

I consider moving to bun, but my project just will not start with it :sad:

What is the feature you are proposing to solve the problem?

Adding dependencies hoisting

What alternatives have you considered?

Whatever will work with this project structure

Bessonov commented 9 months ago

As discussed here, it is considered a bad practice and can lead to issues. More stringent package managers like pnpm disallow it by default. I hope bun will fix this by implementing behavior similar to pnpm.

Additionally, you are describing behavior that aligns with how bun already works and is documented, except in cases of version conflicts. You can verify this by checking your file system after installation.

You run into other issues. I can run your project with small fixes:

diff --git a/package.json b/package.json
index 963d015..45709b3 100644
--- a/package.json
+++ b/package.json
@@ -3,8 +3,9 @@
   "private": true,
   "version": "0.1.0",
   "workspaces": [
-    "packages/**",
-    "website/**"
+    "packages/core/*",
+    "packages/product/*",
+    "website/*"
   ],
   "scripts": {
     "website:dev": "cd website && yarn dev",
@@ -13,6 +14,8 @@
     "ts": "yarn run tsc --noEmit"
   },
   "dependencies": {
+    "@dwreact/core-layout": "workspace:*",
+    "@dwreact/product-board": "workspace:*",
     "@emotion/css": "^11.7.1",
     "@emotion/react": "^11.7.1",
     "@emotion/styled": "^11.6.0",

image

I would suggest that you do not switch to bun.

ozyman42 commented 3 months ago

Dependency hoisting is an anti-pattern