Skip to content

Commit d53a7a7

Browse files
authored
create-next-app: Add ignoreScripts for unrs-resolver on bun (#86324)
`unrs-resolver`'s postinstall script is only needed for legacy versions of npm, so it's safe to ignore: unrs/unrs-resolver#193 (comment) Without this, bun blocks the postinstall script (okay) and logs a warning (not ideal, confusing to end users). This prevents it from running and suppresses the warning. This matches what we now do in `pnpm` (#83168) but for `bun`. Context: - https://vercel.slack.com/archives/C03KAR5DCKC/p1763570835510729 - https://vercel.slack.com/archives/C06DNAH5LSG/p1763580178004169 ## Before ![CleanShot 2025-11-19 at 08.46.56@2x.png](https://app.graphite.com/user-attachments/assets/4979ca3c-0a05-4c05-831a-93c358832ed4.png) ## After ![Screenshot 2025-11-19 at 1.02.01 PM.png](https://app.graphite.com/user-attachments/assets/f99b419b-a30e-449a-9118-77621b15fcd9.png)
1 parent 8ce869f commit d53a7a7

File tree

1 file changed

+13
-0
lines changed
  • packages/create-next-app/templates

1 file changed

+13
-0
lines changed

packages/create-next-app/templates/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,19 @@ export const installTemplate = async ({
340340
);
341341
}
342342

343+
if (packageManager === "bun") {
344+
// Equivalent to pnpm's `ignoredBuiltDependencies`, added in bun 1.3.2.
345+
// - https://bun.com/blog/bun-v1.3.2#faster-bun-install
346+
// - https://github.com/oven-sh/bun/pull/24283
347+
// Bun ignores `sharp` by default, but does not ignore `unrs-resolver`
348+
// unless configured.
349+
packageJson.ignoreScripts = ["sharp", "unrs-resolver"];
350+
// The script must be in *both* `ignoreScripts` and `trustedDependencies` to
351+
// suppress the warning. This could change in future versions of Bun.
352+
// https://vercel.slack.com/archives/C06DNAH5LSG/p1763582930218709?thread_ts=1763580178.004169&cid=C06DNAH5LSG
353+
packageJson.trustedDependencies = ["sharp", "unrs-resolver"];
354+
}
355+
343356
await fs.writeFile(
344357
path.join(root, "package.json"),
345358
JSON.stringify(packageJson, null, 2) + os.EOL,

0 commit comments

Comments
 (0)