Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 26.9k
V5 add back support for node builtins#11764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
166d8725e83115944a50acb4a8a3e6b5b3a46b4e0c17fa02220dada7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||||||||
| --- | ||||||||||||
| id: nodejs-builtin-fallbacks | ||||||||||||
| title: NodeJS builtin fallbacks | ||||||||||||
| --- | ||||||||||||
| NodeJS builtin fallbacks enable you to import NodeJS builtin modules meant for Node and fallback to browser specific modules in your web application. | ||||||||||||
| Per default Create React App set fallbacks to empty modules in production build and development fallbacks in development mode. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did some light copy edits. but this sentence isn't very clear, could you clarify what you mean by 'empty modules' and 'development fallbacks'? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think this is how the sentence was intended, connecting to the previous sentence. I changed the inclusion to past tense. | ||||||||||||
| In development mode you might get error messages in your browser console similar to: | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
i'm seeing the errors in my terminal where i'm running | ||||||||||||
| ``` | ||||||||||||
| (dev) Error: Module "path" not found, cannot access property "join", please read https://create-react-app.dev/docs/nodejs-builtin-fallbacks | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this appears to be a broken link | ||||||||||||
| ``` | ||||||||||||
| _(It's possible to disable these warnings in development using the environment variable: `DISABLE_MISSING_NODEJS_BUILTIN_MODULE_FALLBACK_WARNING=true`)_ | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
| ||||||||||||
| **IMPORTANT:** Before fixing this dependency, please make sure to only use Npm packages meant for the browser and not for Node / backend. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
| ||||||||||||
| It takes abit of work but visit the project documentation, README.md and if on GitHub etc. look open and closed issues in the project e.g. search "browser" to see if maintainers close issues for browser support. | ||||||||||||
| ||||||||||||
| It takes abit of work but visit the project documentation, README.md and if on GitHub etc. look open and closed issues in the project e.g. search "browser" to see if maintainers close issues for browser support. |
i don't think this is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Implications of loading packages not build for the browser can vary from security, bundle size etc. - There might be better alternatives. | |
| There can be unexpected implications of loading packages not build for the browser which include security, bundle size etc. It is generally a better to use packages intended for the browser if possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **Escape hatch** | |
| ## Escape hatch |
mongodbenApr 14, 2022 •
edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To fix the issue you will need to add the browser fallback - the example above complains about missing `path` module. | |
| If you cannot find a native browser replacement module, you can use one of the following polyfills. | |
| You just have to install the module, and Create React App will use it. | |
| For example, to address the above-mentioned error message for the `path` module, run: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Create React App will recognize the fallback and use that instead of an empty module. |
removing b/c covered in the previous suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _(Find the fallback package in the table bellow)_ | |
| Create React App supports the following fallback module polyfills. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: should be process/browser (missing r at the end).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least half the names in the 2nd column seem to be missing their last letter:
browserifshould bebrowserify? (multiple variants)stream-httshould bestream-http?readable-stream/dupleshould bereadable-stream/duplex?
etc etc etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're looking at this at the moment, and just noticed this issue too. Thanks @no23reason and @PjotrB.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.