Comparing version 16.1.2 to 16.1.3
@@ -7,2 +7,8 @@ # Changelog | ||
## [16.1.3](https://github.com/motdotla/dotenv/compare/v16.1.2...v16.1.3) (2023-05-31) | ||
### Removed | ||
- Removed `browser` keys for `path`, `os`, and `crypto` in package.json. These were set to false incorrectly as of 16.1. Instead, if using dotenv on the front-end make sure to include polyfills for `path`, `os`, and `crypto`. [node-polyfill-webpack-plugin](https://github.com/Richienb/node-polyfill-webpack-plugin) provides these. | ||
## [16.1.2](https://github.com/motdotla/dotenv/compare/v16.1.1...v16.1.2) (2023-05-31) | ||
@@ -9,0 +15,0 @@ |
{ | ||
"name": "dotenv", | ||
"version": "16.1.2", | ||
"version": "16.1.3", | ||
"description": "Loads environment variables from .env file", | ||
@@ -58,11 +58,8 @@ "main": "lib/main.js", | ||
}, | ||
"browser": { | ||
"fs": false, | ||
"path": false, | ||
"os": false, | ||
"crypto": false | ||
}, | ||
"engines": { | ||
"node": ">=12" | ||
}, | ||
"browser": { | ||
"fs": false | ||
} | ||
} |
@@ -528,2 +528,40 @@ <div align="center"> | ||
### Why am I getting the error `Module not found: Error: Can't resolve 'crypto|os|path'`? | ||
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: | ||
```bash | ||
npm install node-polyfill-webpack-plugin | ||
``` | ||
Configure your `webpack.config.js` to something like the following. | ||
```js | ||
require('dotenv').config() | ||
const path = require('path'); | ||
const webpack = require('webpack') | ||
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin') | ||
module.exports = { | ||
mode: 'development', | ||
entry: './src/index.ts', | ||
output: { | ||
filename: 'bundle.js', | ||
path: path.resolve(__dirname, 'dist'), | ||
}, | ||
plugins: [ | ||
new NodePolyfillPlugin(), | ||
new webpack.DefinePlugin({ | ||
'process.env': { | ||
HELLO: JSON.stringify(process.env.HELLO) | ||
} | ||
}), | ||
] | ||
}; | ||
``` | ||
Alternatively, just use [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) which does this and more behind the scenes for you. | ||
### What about variable expansion? | ||
@@ -530,0 +568,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67914
591