Commit Graph

2 Commits

Author SHA1 Message Date
Niklas Mischkulnig 9d792e35f9 Cover org package external in externals-transitive test (#86691)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the PR.
- Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to understand the PR)
- When linking to a Slack thread, you might want to share details of the conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2025-12-01 23:18:30 +01:00
Niklas Mischkulnig 7905cb4cc3 Turbopack: write symlinks to access transitive serverExternalPackages
(#86375)

Closes PACK-5936

This alleviates a long-standing painpoint of `serverExternalPackages`. If you are using
`some-utility` which uses `lodash`, and you have to make `lodash` a `serverExternalPackages`, then
you'd have to add the correct version of `lodash` to your application's dependencies in package.json.

This is not very ergonomic as it leaks the internal implementation of your direct dependencies (you
shoudln't have to care about their transitive dependencies). And it's easy to run into a situation
where it's impossible to satisfy all dependencies, if you'd have to add two conflicting versions of `lodash` for example.

Instead, Turbopack now emits symlinks like

```
.next/node_modules/lodash-98e63531e9336dd0@ -> ../../../../node_modules/.pnpm/lodash@4.17.20/node_modules/lodash
.next/node_modules/lodash-ee4fa714b6d81ca3@ -> ../../../../node_modules/.pnpm/lodash@3.10.1/node_modules/lodash
```

.so that `.next/server/chunks/29adj2sd9.js` can then contain a `require("lodash-98e63531e9336dd0")`
and alway get the correct version (and without the user having to declare them).
2025-11-26 17:05:22 +01:00