FormidableLabs / FormidableLabs/nextjs-serverless-demo
Feature: Inflate configuration like Next.js does internally.
- Dominant language
- JavaScript
- Stars
- 9
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
## Background
Use case is that we want to get Next.js configured for the server-side as follows:
* Ideally mimic something like `assignDefaults` in https://unpkg.com/browse/next@12.1.4/dist/server/config.js wherein we pass a config object from reading `next.config.js` and get it all fixed up per that function.
* Unfortuately, we can't do this because (1) `assignDefaults` is not exported, and (2) we don't want to `require` anything that has Next's webpack stuff involved (for `loadConfig`s webpack hooks).
For our current code, we have a pure object (with object values but no arrays), which we can get away with a naive `Object.assign()` on, but this lacks:
1. Handling arrays, functions, etc.
2. Validation, checking, etc.
Like the real `assignDefaults` and `loadConfig` do in Next.js proper.
## Task
- [ ] Find some way to get all the Next.js configuration goodness and parity.
## Ideas
- [ ] Find a third party library
- [ ] Build and monkey patch `dist/server/config.js` to a new file that exports `assignDefaults`
- [ ] At _build time_ inflate the server object using `assignDefaults` and write it out to disk that gets included in the zip bundle.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.