Skip to content

Feature: Inflate configuration like Next.js does internally. #18

@ryan-roemer

Description

@ryan-roemer

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/[email protected]/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 loadConfigs 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions