oven-sh / bun

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

Bun keep install devDependencies on project #15107

Open indrazm opened 1 week ago

indrazm commented 1 week ago

What version of Bun is running?

1.1.21+70ca2b76c

What platform is your computer?

Linux 5.15.153.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

I am currently build an npm package with bun. However when i do install. It will install extraneous dependencies.

if i do bun i it will install me all dependencies, even the devDependencies. But if i do npm i it will install me only dependencies, NOT devDependencies.

Here is my package.json.

{
    "name": "litojs",
    "version": "0.0.1",
    "main": "src/index.ts",
    "type": "module",
    "exports": {
        ".": "./src/index.ts"
    },
    "scripts": {
        "lint": "bunx eslint ./src"
    },
    "devDependencies": {
        "@types/bun": "latest",
        "@eslint/js": "^9.14.0",
        "@types/eslint__js": "^8.42.3",
        "eslint": "^9.14.0",
        "eslint-plugin-simple-import-sort": "^12.1.1",
        "typescript-eslint": "^8.13.0"
    },
    "peerDependencies": {
        "typescript": "^5.6.3"
    },
    "dependencies": {
        "chalk": "^5.3.0"
    }
}

What is the expected behavior?

The expected behaviour is only Install Dependencies, without devDependencies.

What do you see instead?

This is when i do install using bun. Image

This is when i do install using npm. Image

Additional information

No response

dylan-conway commented 1 week ago

Do you have omit=dev in a .npmrc file? I believe this is happening because bun isn't reading the omit config setting

indrazm commented 1 week ago

Hey @dylan-conway yes. it's there. But still installing the devDependencies. Here is what i have did :

npm ci ✅ 
npm i ✅ 

bun i ❌ 
bun i --production ❌ 
bun i --omit=dev ❌ 

✅ installing only dependencies ❌ include the devDependencies

Current way to fix this at the moment is : npm prune