-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add better errors when referencing missing components
Previously, React or other JSX runtimes threw rather hard to read errors when a component was undefined (because it wasn’t imported, passed, or provided), essentially only pointing to *something* missing. Now we throw proper errors when a component is missing at runtime, including what exact component (or object) is undefined. In addition, this adds a `development` option, which defaults to `false` but can be configured explicitly or turned on with `NODE_ENV=development`. When it’s `true`, the exact place that references the missing component or object, and which file did that, is included in the error message. Related-to: mdx-js/mdx#1775.
- Loading branch information
Showing
11 changed files
with
412 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const development = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import process from 'node:process' | ||
|
||
export const development = process.env.NODE_ENV === 'development' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.