You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -525,19 +525,43 @@ There are two alternatives to this approach:
525
525
1. Preload dotenv: `node --require dotenv/config index.js` (_Note: you do not need to `import` dotenv with this approach_)
526
526
2. Create a separate file that will execute `config` first as outlined in [this comment on #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822)
527
527
528
-
### Why am I getting the error `Module not found: Error: Can't resolve 'crypto|fs|os|path'`?
528
+
### Why am I getting the error `Module not found: Error: Can't resolve 'crypto|os|path'`?
529
529
530
-
You are using dotenv on the front-end. Webpack < 5 used to include polyfills for core Node.js modules like `crypto`, `fs`, `os`, and `path`. It doesn't any longer, so these days you need to install and configure a polyfill for it.
530
+
You are using dotenv on the front-end and have not included a polyfill. Webpack < 5 used to include these for you. Do the following:
531
531
532
532
```bash
533
-
npm install crypto-browserify
533
+
npm install node-polyfill-webpack-plugin
534
534
```
535
535
536
-
And then configure it in your webpack config.
536
+
Configure your `webpack.config.js` to something like the following.
Alternatively, just use [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) which does this and more behind the scenes for you.
0 commit comments