
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
webpack-env
Advanced tools
read variables from a .env.js file and make them available to webpack as globals
Webpack ENV is a webpack plug-in for creating ENV-variable-like globals in webpack.
First add Webpack Env as a webpack plug-in, using gulp this would look something like this:
//gulpfile.js
var gulp = require('gulp');
var webpack = require('webpack');
var webpackEnv = require('webpack-env');
gulp.task('webpack', function() {
return gulp.src('./entry.js')
.pipe(webpack({
output: {
filename: 'bundle.js'
},
plugins: [webpackEnv]
}))
.pipe(gulp.dest('build/'));
});
Create a .env.js
file in the same directory as your gulpfile.js.
This file should export an object that contains the eventual globals
you want your webpack code to contain:
module.exports = {
SOME_VAR: 'some val'
}
Weback Env also supports having multiple files for multiple environments.
To create a set of Production environment globals, just create a .production_env.js
file and run gulp with NODE_ENV set to 'production'.
Be sure you've added all your .env
files to your .gitignore
.
FAQs
read variables from a .env.js file and make them available to webpack as globals
The npm package webpack-env receives a total of 3,207 weekly downloads. As such, webpack-env popularity was classified as popular.
We found that webpack-env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.