-
Notifications
You must be signed in to change notification settings - Fork 90
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I've added a test fixture and copied the |
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. |
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 in d98f5b2
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 |
Only matching |
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!
Description
TLDR: This change makes
next build --turbopack
work on NetlifyWas investigating why
next build --turbopack
fails when deploying on Netlify:.next/server/chunks/*
instead of.next/server/chunks/**/*
in the standalone dir..next/standalone/.next
not just.next/*
and.next/server/**/*
.js
because that would exclude e.g. sourcemaps which are.js.map
files.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 --turbopack
app.You can test this change yourself like so:
Relevant links (GitHub issues, etc.) or a picture of cute animal