Coder Social home page Coder Social logo

webpack-config-utils's Introduction

webpack-config-utils's People

Contributors

adamdicarlo avatar allcontributors[bot] avatar andrewmcodes avatar ashiknesin avatar benhalverson avatar bzalasky avatar cs-miller avatar huy-nguyen avatar jdorfman avatar jezzay avatar klzns avatar nmaves avatar rrag avatar ryandrewjohnson avatar tamouse avatar vernondegoede avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

webpack-config-utils's Issues

Configurable ifXXX

I usually have a dev, prod and watch build,

  • watch has hmr entrypoints, hmr plugin, no uglify and eval as devtool
  • dev has no uglify plugin, sourcemap devtool
  • prod has uglify plugin, sourcemap devtool

Now 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 has a qs vuln

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

Cannot figure out the webpack config transpiling trick

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.

Should propIf instantiate stuff only when it evaluates to true?

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"',
    },
  }
)

Missing function

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')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.