1.1.1 • Published 6 years ago

extensible-react-scripts v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Extensible React Scripts

react-scripts version: 1.1.0

Why?

The official react-scripts that is included in Create React App does not allow any custom webpack configuration, which leads to people using more eject than we wanted to.

Solution

Allow users to extend webpack configuration.

Usage

New projects

create-react-app APP_NAME_HERE --scripts-version extensible-react-scripts

Edit the cra.config.js file generated at the root of the project.

Existing projects

  • yarn remove react-scripts
  • yarn add --dev extensible-react-scripts
  • Create a file named cra.config.js at the root of the project (outside src folder) exporting a function like below:
cra.config.js example
module.exports = {
  webpack: function(webpackConfig, { isDevelopment }) {
    // modify webpack config here
    const config = Object.assign({}, webpackConfig)

    // return the modified version
    return config
  },
}

That's it!

Available configurations

ConfigFormatReturn type
pathsfunction(paths, { isDevelopment, resolvePath })Object
webpackfunction(webpackConfig, { isDevelopment, paths, resolvePath })Object

Versioning

The version will be the same of the official react-scripts. Check package.json or the top of this file.

Related projects

https://github.com/timarney/react-app-rewired

react-app-rewired by @timarney

configurable-react-scripts by @svrcekmichal

Maintainer

Bruno Lemos (@brunolemos on twitter)