This repository was archived by the owner on Jan 28, 2025. It is now read-only.
Dynamically built and deployed next pages #1
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.
Motivation
Currently, to deploy a next page a function needs to be specified in the
serverless.ymlfile. For example:For a few pages this is fine, but applications with 10 or more pages it becomes very repetitive and difficult to maintain.
Proposed solution
Default plugin behaviour
The plugin will automatically detect any pages by looking at the next build directory. For example, let say we have two pages:
.next/serverless/pages/home.js.next/serverless/pages/about.jsInstead of declaring the functions for these pages in the
serverless.ymlfile, the plugin will automatically include them in the deployment.The following configuration will be used for each page:
Using homePage as an example:
Overriding defaults
The user can override a page function configuration by declaring it in the
serverless.ymlfile. The plugin will merge the user provided configuration into the defaults above. Note the function name specified has to match{name}Page.