Skip to content

publicRuntimeConfig shouldn’t be undefined on build #7713

@tusbar

Description

@tusbar

Bug report

Describe the bug

v8.1.1-canary.62 (or maybe 3aed76f) (re-)introduces an issue with how I use (and recommend how to use) https://github.com/tusbar/next-runtime-dotenv.

To Reproduce

This breaks on build as publicRuntimeConfig is undefined at build time:

const {
  publicRuntimeConfig: {MY_API_URL}
} = getConfig()

Expected behavior

publicRuntimeConfig used to be {} at build time.

System information

  • OS: macOS
  • Version of Next.js: 8.1.1-canary.62

Additional context

This is not the first time this breaks, maybe it would be nice to add a test. It used to work fine with 8.0.4, it’s broken in 8.1.0 and used to work fine in canary before 8.1.1-canary.62. Broken in 9.0 as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions