react-scripts-webpack-config-editor

1.0.1 • Public • Published

react-scripts-webpack-config-editor

edit the react-scripts webpack config at runtime.

Codeship Status for cdaringe/react-scripts-webpack-config-editor JavaScript Style Guide

install

npm install --save-dev react-scripts-webpack-config-editor

usage

  • update your package.json and add an install script
// package.json
{
  "scripts": {
    "install": "react-scripts-webpack-config-editor <my-webpack-transformer.js>"
  }
}
  • add your transformer
// my-webpack-transformer.js
module.exports = function editWebpackConfig (webpackConfig) {
  // webpackConfig is the parsed JS webpack config from react-scrips.
  // modify it here synchronously, & return it.
  return Object.assign({}, webpackConfig, {
    ...my-webpack-customizations
  })
}

why

you love create-react-app, but need just a tiny tweak to the build process.

why not

the whole point of sticking with react-scripts is offloading the complexity of the build system (webpack), and getting rolling updates. tweaking it implies that you want ownership of the build process!

justification

if you must change the build used by react-scripts (create-react-app) you can either fork the project, or react-scripts eject. until now!

  • forking stinks. rolling updates come with a cost of you or your team pulling down the upstream project. further, git conflicts are bound to follow.
  • ejecting stinks. you get a ton of code pushed into your codebase & immediately onboard technical debt by absorbing all of that code.

your custom modifications are sure to break when you bump react-scripts. however, the amount of modifications should be limited, so hopefully you only need to patch a few lines in your transformer.

Readme

Keywords

none

Package Sidebar

Install

npm i react-scripts-webpack-config-editor

Weekly Downloads

302

Version

1.0.1

License

MIT

Unpacked Size

199 kB

Total Files

8

Last publish

Collaborators

  • cdaringe