- Notifications
You must be signed in to change notification settings - Fork96
fix: glob subdirectories in server/chunks to support Turbopack builds#2987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
timneutkens commentedJul 6, 2025
I've added a test fixture and copied the |
pieh commentedJul 8, 2025
Firstly, huge thanks for PR!
Awesome find, thank you!
Limiting to Expanding a bit on selective dirs globbing - it was done to try to limit chances of exceeding function max size. We do generate single function for all routes today (hopefully to be changed with adapters), so it's easier in this setup to go over the edge than with function per route. This makes this change a bit risky for us and instead I'd like to suggest following: Could we keep this change to only target turbopack builds needs for right now? My understanding just from reading first 2 points is that it could be addressed by adjusting our Then I would follow up with some ~telemetry addition to asses impact of doing the change in this PR almost as-is (just with added exclussion for default filesystem CacheHandler entries) on size of produced lambda to understand if this is generally safe change for us to roll out or would this result in failures (function size too large) for some users. I'm happy to take over getting this over the finish line if you wish, just let me know what your thoughts are on this. |
pieh commentedJul 8, 2025
I was checking out failing test and seems to me that those failures are actually caused by including those CacheHandler entries in function without making adjustments elsewhere. To be fair the handling is a bit brittle and not resiliant to changes like that, but it was operating under assumption that opennextjs-netlify/src/run/next.cts Lines 96 to 126 ind98f5b2
I'll attempt to open PR with optimistic change that scales back the globbing part to what seems like turbopack builds specific needs to verify that is indeed what's needed |
timneutkens commentedJul 8, 2025
Only matching |
Uh oh!
There was an error while loading.Please reload this page.
pieh left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank You!
e7bf18f intoopennextjs:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description
TLDR: This change makes
next build --turbopackwork on NetlifyWas investigating why
next build --turbopackfails when deploying on Netlify:.next/server/chunks/*instead of.next/server/chunks/**/*in the standalone dir..next/standalone/.nextnot just.next/*and.next/server/**/*.jsbecause that would exclude e.g. sourcemaps which are.js.mapfiles.For now to verify if there's a specific reason the subdirectories were targeted I've changed the glob to
.next/server/**/*in order to see if any tests fail.Documentation
Tests
TODO: This needs a
next build --turbopackapp.You can test this change yourself like so:
Relevant links (GitHub issues, etc.) or a picture of cute animal