envkey-webpack-plugin
Advanced tools
Comparing version 0.1.0 to 0.1.1
16
index.js
var webpack = require('webpack'), | ||
envkey = require('envkey/loader') | ||
module.exports = EnvkeyWebpackPlugin; | ||
module.exports = EnvkeyWebpackPlugin | ||
function EnvkeyWebpackPlugin(opts) { | ||
var env = envkey.load(opts), | ||
defineParams = { NODE_ENV: JSON.stringify(process.env.NODE_ENV) } | ||
defineParams = {} | ||
for (k in env) defineParams[k] = JSON.stringify(env[k]); | ||
if (!opts.permitted || !opts.permitted.length){ | ||
throw new Error("'permitted' key required to specifiy vars whitelisted for client.") | ||
} | ||
return new webpack.DefinePlugin({"process.env": defineParams}); | ||
if (opts.permitted.indexOf("NODE_ENV") > -1){ | ||
defineParams.NODE_ENV = JSON.stringify(process.env.NODE_ENV) | ||
} | ||
for (k in env) defineParams[k] = JSON.stringify(env[k]) | ||
return new webpack.DefinePlugin({"process.env": defineParams}) | ||
} |
{ | ||
"name": "envkey-webpack-plugin", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Use envkey as a webpack plugin.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3344
14
0