nextjs - 💡(How to fix) Fix `compiler.define` config should support booleans [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87644Fetched 2026-04-08 02:06:45
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
1
Participants
Timeline (top)
subscribed ×3issue_type_added ×1issue_type_changed ×1labeled ×1

Code Example

compiler: {
    define: {
      __DEV__: true
    }
}

---

Invalid next.config.mjs options detected:
Expected string, received boolean at "compiler.define.__DEV__"

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.2 // Latest available version is detected (16.1.1-canary.2).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/sad-newton-46k4vy?workspaceId=ws_PDRFoG8FgfRsVn1md1HhrU

To Reproduce

  1. Add to your config:
  compiler: {
    define: {
      __DEV__: true
    }
}
  1. next build

Current vs. Expected behavior

Currently this works, but produces a warning:

Invalid next.config.mjs options detected:
Expected string, received boolean at "compiler.define.__DEV__"

No warning should be emited, type must be adjusted

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.2 // Latest available version is detected (16.1.1-canary.2).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

TL;DR

The warning can be resolved by changing the type of __DEV__ in next.config.mjs to a string.

Guidance

  • Verify that the issue is caused by the __DEV__ value being a boolean instead of a string by checking the next.config.mjs file.
  • Update the next.config.mjs file to use a string value for __DEV__, for example:
compiler: {
  define: {
    __DEV__: 'true'
  }
}
  • Run next build again to check if the warning is resolved.
  • If the issue persists, check the Next.js documentation for any specific requirements for the compiler.define options.

Notes

This solution assumes that the warning is caused by the type mismatch and that changing the type to a string will resolve the issue. If the issue is more complex, additional debugging may be required.

Recommendation

Apply workaround: changing the type of __DEV__ to a string, as this is a simple and non-invasive fix that is likely to resolve the warning.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix `compiler.define` config should support booleans [1 participants]