-
Notifications
You must be signed in to change notification settings - Fork 89
feat: split up API Routes + use .nft.json files to make builds fast #2058
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
Merged
Merged
Changes from 68 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
418c46d
feat: split up API Routes
Skn0tt 6e27836
feat: load includedFiles for every page
Skn0tt c09022c
refactor: extract function config logic
Skn0tt 2ffd7a2
refactor: extract flag into own definition
Skn0tt 0844815
feat: use "none" bundler for split-up api routes
Skn0tt 60e71de
feat: list some more dependencies
Skn0tt caf4b69
feat: use NFT to trace common required files
Skn0tt d812eb6
refactor: clean up a wee bit
Skn0tt eb2abe8
fix: please don't include /sh
Skn0tt 0f9cf0f
feat: enable flag by default, so tests use it
Skn0tt 699ba69
feat: add a naïve packing algo
Skn0tt 0a4fc56
feat: write rough sketch for packing lambdas
Skn0tt 4cc2aff
refactor: add constructor for APILambda
Skn0tt 12ebf75
feat: pack handlers together into bundles
Skn0tt 3623916
fix: linter
Skn0tt 45c3834
feat: exclude some heavy unneeded files
Skn0tt 029dd98
Merge branch 'main' into split-api-routes
Skn0tt e5c4f23
fix: trigger CI again, now that it supports `none` bundler
Skn0tt 57772f2
feat: remove code for old mechanism
Skn0tt 567692d
fix: remove test for deleted code
Skn0tt 7c0daa8
fix: ensure that react doesn't try to load development build
Skn0tt abec92a
fix: move test directory into repo, so node_modules can be read
Skn0tt 63b8a73
fix: snapshot with API redirects
Skn0tt 94de480
fix: remove .only
Skn0tt 1d43d6b
Merge branch 'main' into split-api-routes
Skn0tt 7af428b
fix: don't assert on _api_*
Skn0tt 8664788
fix: another test
Skn0tt 1ed2b9c
fix: apply NODE_ENV=prod to right generated handler
Skn0tt 8807dd6
Merge branch 'main' into split-api-routes
Skn0tt eef0c6c
feat: remove nft tracing
Skn0tt 0f5a144
feat: put change behind flag again
Skn0tt ea47ceb
feat: source flag from plugin input
Skn0tt cf24ee1
fix: add default value for featureflags
Skn0tt d757ead
Merge branch 'main' into split-api-routes
Skn0tt bb4d4cf
fix: default flag to true for testing
Skn0tt bf2983b
fix: revert changes to lockfiles
Skn0tt 34257d8
fix: eslint it/test
Skn0tt c8e728c
fix: lint
Skn0tt 52b79f8
fix: revert distracting change
Skn0tt 2a4ceae
fix: now that we don't use nft anymore, we don't have to copy over no…
Skn0tt 9d76dd4
Merge remote-tracking branch 'origin/main' into split-api-routes
nickytonline c896db1
fix: swallow require.resolve errors for unit tests
Skn0tt 16aa3a1
fix: remove timing logs
Skn0tt dbaf631
fix: lint name
Skn0tt 25190c6
Merge branch 'main' into split-api-routes
Skn0tt 84cceb3
fix: lint
Skn0tt b09317e
fix: isr needs _document.js
Skn0tt 3c19e25
fix: add _app for ISR
Skn0tt 157f29d
fix: correct wrong output of some npm versions
Skn0tt 78a2753
fix: integration test
Skn0tt fc371c3
fix: assemble npm package path correctly, also for monorepos
Skn0tt 5131d74
fix: try what happens if we use next-netlify server
Skn0tt 7a8df05
fix: check what happens when we skip revalidation
Skn0tt df0ea5a
fix: dont let revalidate request time out
Skn0tt 25e8a99
fix: send x-nextjs-cache header to prevent error
Skn0tt c78e10d
fix: update error message in test
Skn0tt 9216fea
fix: resolve relative paths based on data in required-server-files
Skn0tt d40beb0
fix: test
Skn0tt 71f7bf2
fix: keep manually-added `included_files`
Skn0tt 29a40a7
Merge branch 'main' into split-api-routes
Skn0tt 118bf89
fix: try something
Skn0tt 008014a
fix: don't include unneeded _app pages in ISR
Skn0tt 0a44c6d
fix: finalize includedFiles before writing it onto netlifyConfig
Skn0tt 0f4b522
chore: update comment
Skn0tt b799a19
fix: exclude sass file in monorepos
Skn0tt 70a4fb2
Update packages/runtime/src/helpers/functions.ts
Skn0tt 89fd2fb
chore: remove comment
Skn0tt f9f726f
fix: update flag impl
Skn0tt 88f9b3e
refactor: use getRequiredServerFiles
Skn0tt 223990e
chore: add comment on route[0]
Skn0tt 6089296
fix: set NEXT_SPLIT_API_ROUTES in netlify.toml
Skn0tt 30db86a
fix: put updated revalidate behaviour behind flag
Skn0tt e3c2c4d
fix: supply splitApiRoutes in getHandler
Skn0tt 6287e15
fix: better run your code before committing it and embarrassing yourself
Skn0tt fdcf8d5
Merge branch 'main' into split-api-routes
Skn0tt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ on: | |
push: | ||
branches: [main] | ||
|
||
env: | ||
NEXT_SPLIT_API_ROUTES: true | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import destr from 'destr' | ||
|
||
/** | ||
* If this flag is enabled, we generate individual Lambda functions for API Routes. | ||
* They're packed together in 50mb chunks to avoid hitting the Lambda size limit. | ||
* | ||
* To prevent bundling times from rising, | ||
* we use the "none" bundling strategy where we fully rely on Next.js' `.nft.json` files. | ||
* This should to a significant speedup, but is still experimental. | ||
* | ||
* If disabled, we bundle all API Routes into a single function. | ||
* This is can lead to large bundle sizes. | ||
* | ||
* Disabled by default. Can be overriden using the NEXT_SPLIT_API_ROUTES env var. | ||
*/ | ||
export const splitApiRoutes = (featureFlags: Record<string, unknown>): boolean => | ||
destr(process.env.NEXT_SPLIT_API_ROUTES) ?? featureFlags.next_split_api_routes ?? false |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.