Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to replace the use of
next/dist/compiled/*
with@next/vendored/*
.Motivation
next/src/compiled
from source. Currently Next.js clones its contents intonext/dist/compiled
but we can run the tasks that generate the modules fast enough with caching.next/dist/compiled/*
will now to go@next/vendored/*
, a separate package that has all the third party modules that were compiled by ncc. This allows Next.js to haveexports
insidepackage.json
in a future update, which is currently highly difficult due to it having inner node packages (i.e nested modules that are resolved after reading apackage.json
).next
repo.Status
Some things that have been done so far:
taskr
. The reason istaskr
doesn't work very well with ESM (The@taskr/esnext
package is a hack and it's still commonjs), because of this resolving a package always sends its commonjs distribution to ncc. There are also some differences in how the tasks are declared, particularly I wanted to have a way to generate multiple tasks with a loop for the most common cases.Todo
next
to@next/vendored
Testing locally
After running
pnpm install
, build@next/vendored
with:and then run the ncc tasks in
@next/vendored
:Run
pnpm dev
at the root and the Next.js build should work. I'm testing it locally in an app from create-next-app and withpnpm next-with-deps