kentcdodds / webpack-config-utils Goto Github PK
View Code? Open in Web Editor NEWUtilities to help your webpack config be easier to read
License: MIT License
Utilities to help your webpack config be easier to read
License: MIT License
I usually have a dev, prod and watch build,
hmr
entrypoints, hmr
plugin, no uglify and eval
as devtool
sourcemap
devtoolsourcemap
devtoolNow it seems it is not possible to do a ifWatch
https://github.com/kentcdodds/webpack-config-utils/blob/master/src/get-if-utils.js#L43
How about make this configurable and default to this current
const vars = ['production', 'prod', 'test', 'development', 'dev']
I am thinking something like
...
* `process.env.NODE_ENV`.
* @return {IfUtils} the IfUtils object for the given environment
*/
+ function getIfUtils(env, vars = ['production', 'prod', 'test', 'development', 'dev']) {
- function getIfUtils(env) {
env = typeof env === 'string' ? {[env]: true} : env
if (typeof env !== 'object') {
...
)
}
- const vars = ['production', 'prod', 'test', 'development', 'dev']
return vars.reduce((utils, variable) => {
const envValue = !!env[variable]
const capitalVariable = capitalizeWord(variable)
...
so now I can do
const { ifProduction, ifDev, ifWatch } = getIfUtils(mode, ['production', 'dev', 'watch'])
This package depends on webpack-combine-loaders
, which depends on qs
5.2.1
.
The qs
package has a known vulnerability: https://snyk.io/vuln/npm:qs:20170213.
I created a PR for jsdf/webpack-combine-loaders#10. Once a new version has been released, its version should be bumped for this package as well.
qs vulnerable to Prototype Pollution - GHSA-hrpp-h998-j3pp
fix available via npm audit fix
node_modules/webpack-config-utils/node_modules/qs
1 high severity vulnerability
Looks like no one is updating this package anymore?
Thanks
It appears that the SSL cert for https://doclets.io/kentcdodds/webpack-config-utils/master has expired. Just thought you might want to take a look at that.
I would gladly help out just not sure if you want to move that way or not.
The roadmap.md file is missing
In the README and in your class, you mentioned:
Protip: You can name your config file webpack.config.babel.js and it'll be automagically transpiled! So you could use ES6 module imports rather than CommonJS requires.
I cannot get this to work, and am unable to google up any other information on it. This repo is the only reference I've been able to find.
Hi @kentcdodds these utils are great!
I first saw them in your egghead course and I have question.
At the moment when one does
ifProduction(
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
})
)
an instance of webpack.DefinePlugin
is created no matter what is the value of envValue
.
Not a big deal probably but I was wondering if it wouldn't be better to have the tool eval
some code or pass the plugin + options.
ifProduction(`
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
})
`)
or
ifProduction(
webpack.DefinePlugin,
{
'process.env': {
NODE_ENV: '"production"',
},
}
)
I see in the docs the use of here
in the following line but I don't see it anywhere in the source.
const {getIfUtils, here} = require('webpack-config-utils')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.