dotenv-webpack
Advanced tools
Comparing version 7.0.3 to 7.1.0
@@ -1,3 +0,3 @@ | ||
var plugin = require('./dist').default | ||
const plugin = require('./dist').default | ||
module.exports = plugin |
@@ -46,2 +46,3 @@ "use strict"; | ||
* @param {Boolean} [options.silent=false] - If true, suppress warnings, if false, display warnings. | ||
* @param {String} [options.prefix=process.env.] - The prefix, used to denote environment variables. | ||
* @returns {webpack.DefinePlugin} | ||
@@ -55,3 +56,4 @@ */ | ||
this.config = Object.assign({}, { | ||
path: './.env' | ||
path: './.env', | ||
prefix: 'process.env.' | ||
}, config); | ||
@@ -169,6 +171,8 @@ } | ||
version = _ref.version; | ||
var expand = this.config.expand; | ||
var _this$config4 = this.config, | ||
expand = _this$config4.expand, | ||
prefix = _this$config4.prefix; | ||
var formatted = Object.keys(variables).reduce(function (obj, key) { | ||
var v = variables[key]; | ||
var vKey = "process.env.".concat(key); | ||
var vKey = "".concat(prefix).concat(key); | ||
var vValue; | ||
@@ -219,7 +223,6 @@ | ||
return targets.every(function (target) { | ||
return (// If we're not configured to never stub | ||
_this.config.ignoreStub !== true && ( // And | ||
// We are configured to always stub | ||
_this.config.ignoreStub === false || // Or if we should according to the target | ||
!target.includes('node') && !isMainThreadElectron(target)) | ||
return (// If configured prefix is 'process.env' | ||
_this.config.prefix === 'process.env.' && // If we're not configured to never stub | ||
_this.config.ignoreStub !== true && ( // We are configured to always stub | ||
_this.config.ignoreStub === false || !target.includes('node') && !isMainThreadElectron(target)) | ||
); | ||
@@ -226,0 +229,0 @@ }); |
{ | ||
"name": "dotenv-webpack", | ||
"description": "A simple webpack plugin to support dotenv.", | ||
"version": "7.0.3", | ||
"version": "7.1.0", | ||
"main": "index.js", | ||
@@ -61,8 +61,7 @@ "scripts": { | ||
"@babel/register": "^7.13.8", | ||
"fs-extra": "^9.1.0", | ||
"husky": "^6.0.0", | ||
"jest": "^26.6.3", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.4", | ||
"jsdoc": "^3.6.7", | ||
"rimraf": "^3.0.0", | ||
"sinon": "^9.0.3", | ||
"sinon": "^11.1.1", | ||
"standard": "^16.0.3", | ||
@@ -69,0 +68,0 @@ "webpack": "^5.24.3" |
@@ -104,2 +104,4 @@ # dotenv-webpack | ||
When the `prefix` option is set, `process.env`s will not be stubbed. | ||
If you are running into issues where you or another package you use interfaces with `process.env`, it might be best to set `ignoreStub: true` and make sure you always reference variables that exist within your code (See [this issue](https://github.com/mrsteele/dotenv-webpack/issues/271) for more information). | ||
@@ -119,2 +121,3 @@ | ||
* **ignoreStub** (`false`) - Override the automatic check whether to stub `process.env`. [Read more here](#user-content-processenv-stubbing--replacing). | ||
* **prefix** (`'process.env.'`) - The prefix to use before the name of your env variables. | ||
@@ -133,3 +136,4 @@ The following example shows how to set any/all arguments. | ||
silent: true, // hide any errors | ||
defaults: false // load '.env.defaults' as the default values if empty. | ||
defaults: false, // load '.env.defaults' as the default values if empty. | ||
prefix: 'import.meta.env.' // reference your env variables as 'import.meta.env.ENV_VAR'. | ||
}) | ||
@@ -136,0 +140,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
17976
11
240
145