# overridable-react-scripts

> Configuration and scripts for Create React App.

Latest version **2.0.4** (published 2019-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install overridable-react-scripts
pnpm add overridable-react-scripts
yarn add overridable-react-scripts
bun add overridable-react-scripts
```

Provides the command `react-scripts`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2019-12-11 |
| First published | 2018-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.10 |
| Dependencies | 53 |
| Unpacked size | 123.1 KB |
| Known vulnerabilities | 0 (+9 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | saranchonkau |

## Links

- npm: https://www.npmjs.com/package/overridable-react-scripts
- Repository: https://github.com/Saranchenkov/overridable-react-scripts
- Homepage: https://github.com/Saranchenkov/overridable-react-scripts#readme
- Issues: https://github.com/Saranchenkov/overridable-react-scripts/issues
- npm.io page: https://npm.io/package/overridable-react-scripts

## Dependencies (53)

- [jest](https://npm.io/package/jest.md) 24.9.0
- [dotenv](https://npm.io/package/dotenv.md) 8.2.0
- [eslint](https://npm.io/package/eslint.md) ^6.6.0
- [semver](https://npm.io/package/semver.md) 6.3.0
- [ts-pnp](https://npm.io/package/ts-pnp.md) 1.1.5
- [resolve](https://npm.io/package/resolve.md) 1.12.2
- [webpack](https://npm.io/package/webpack.md) 4.41.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [fsevents](https://npm.io/package/fsevents.md) 2.1.2
- [camelcase](https://npm.io/package/camelcase.md) ^5.3.1
- [babel-jest](https://npm.io/package/babel-jest.md) ^24.9.0
- [css-loader](https://npm.io/package/css-loader.md) 3.2.0
- [url-loader](https://npm.io/package/url-loader.md) 2.3.0
- [@babel/core](https://npm.io/package/@babel/core.md) 7.7.4
- [file-loader](https://npm.io/package/file-loader.md) 4.3.0
- [sass-loader](https://npm.io/package/sass-loader.md) 8.0.0
- [babel-eslint](https://npm.io/package/babel-eslint.md) 10.0.3
- [babel-loader](https://npm.io/package/babel-loader.md) 8.0.6
- [jest-resolve](https://npm.io/package/jest-resolve.md) 24.9.0
- [style-loader](https://npm.io/package/style-loader.md) 1.0.0
- [@svgr/webpack](https://npm.io/package/@svgr/webpack.md) 4.3.3
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) 5.1.0
- [eslint-loader](https://npm.io/package/eslint-loader.md) 3.0.2
- [postcss-loader](https://npm.io/package/postcss-loader.md) 3.0.0
- [react-dev-utils](https://npm.io/package/react-dev-utils.md) ^10.0.0
- [postcss-normalize](https://npm.io/package/postcss-normalize.md) 8.0.1
- [identity-obj-proxy](https://npm.io/package/identity-obj-proxy.md) 3.0.0
- [pnp-webpack-plugin](https://npm.io/package/pnp-webpack-plugin.md) 1.5.0
- [postcss-preset-env](https://npm.io/package/postcss-preset-env.md) 6.7.0
- [react-app-polyfill](https://npm.io/package/react-app-polyfill.md) ^1.0.5
- [resolve-url-loader](https://npm.io/package/resolve-url-loader.md) 3.1.1
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) 3.9.0
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) 7.16.0
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) 4.0.0-beta.5
- [postcss-safe-parser](https://npm.io/package/postcss-safe-parser.md) 4.0.1
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) 2.18.2
- [jest-watch-typeahead](https://npm.io/package/jest-watch-typeahead.md) 0.4.2
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) 2.2.1
- [babel-preset-react-app](https://npm.io/package/babel-preset-react-app.md) ^9.1.0
- [eslint-plugin-flowtype](https://npm.io/package/eslint-plugin-flowtype.md) 3.13.0
- [eslint-plugin-jsx-a11y](https://npm.io/package/eslint-plugin-jsx-a11y.md) 6.2.3
- [postcss-flexbugs-fixes](https://npm.io/package/postcss-flexbugs-fixes.md) 4.1.0
- [workbox-webpack-plugin](https://npm.io/package/workbox-webpack-plugin.md) 4.3.1
- [eslint-config-react-app](https://npm.io/package/eslint-config-react-app.md) ^5.1.0
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) 0.8.0
- [webpack-manifest-plugin](https://npm.io/package/webpack-manifest-plugin.md) 2.2.0
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^2.8.0
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^1.6.1
- [babel-plugin-named-asset-import](https://npm.io/package/babel-plugin-named-asset-import.md) ^0.3.5
- [jest-environment-jsdom-fourteen](https://npm.io/package/jest-environment-jsdom-fourteen.md) 0.1.0
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^2.8.0
- [optimize-css-assets-webpack-plugin](https://npm.io/package/optimize-css-assets-webpack-plugin.md) 5.0.3
- [case-sensitive-paths-webpack-plugin](https://npm.io/package/case-sensitive-paths-webpack-plugin.md) 2.2.0

## Recent versions

- 2.0.4 (latest) — 2019-12-11
- 2.0.3 — 2019-10-26
- 2.0.1 — 2019-08-23
- 2.0.0 — 2019-08-23
- 2.0.0-beta.0 — 2019-08-23
- 1.0.1 — 2019-06-20
- 1.0.0 — 2019-04-26
- 0.0.7 — 2019-03-10
- 0.0.6 — 2019-02-27
- 0.0.5 — 2019-02-27
- 0.0.4 — 2019-01-11
- 0.0.3 — 2018-12-30
- 0.0.2 — 2018-12-19
- 0.0.1 — 2018-12-18

## README

# overridable-react-scripts

This package includes scripts and configuration used by [Create React App](https://github.com/Saranchenkov/create-react-app).<br>
Please refer to its documentation:

- [Getting Started](https://facebook.github.io/create-react-app/docs/getting-started) – How to create a new app.
- [User Guide](https://facebook.github.io/create-react-app/) – How to develop apps bootstrapped with Create React App.

## Quick Start

To create a project called `my-app`, run this command:

`npx create-react-app my-app --scripts-version overridable-react-scripts`

## How to override configs ?

In your project's root you'll find `react-scripts.override.js` which contains functions that could mutate the paths/webpack/webpackDevServer configuration provided by create-react-app.

If you started project with official `react-scripts`, you should insert this file into the project's root folder:

#### `react-scripts.override.js`
```javascript
/**
 * Function to override paths
 *
 * @param {Object} paths - object contains paths for webpack and other scripts
 * @param {Object} options
 * @param {Function} options.resolveApp - function, which resolve path relative to app directory
 */
function overridePaths(paths, options) {
  return paths;
}

/**
 * Function to override webpack config
 *
 * @param {Object} webpackConfig - webpack config
 * @param {Object} options
 * @param {Object} options.webpack - webpack instance
 * @param {Object} options.paths - object of paths
 * @param {String} options.webpackEnv - "development" or "production"
 */
function overrideWebpackConfig(webpackConfig, options) {
  return webpackConfig;
}

/**
 * Function to override Webpack Dev Server config
 *
 * @param {Object} webpackDevServerConfig - webpack dev server config
 * @param {Object} options
 * @param {Object|Function} options.proxy - proxy config ( https://webpack.js.org/configuration/dev-server/#devserver-proxy )
 * @param {Object} options.allowedHost - public url of dev server ( https://webpack.js.org/configuration/dev-server/#devserver-public )
 */
function overrideWebpackDevServerConfig(webpackDevServerConfig, options) {
  return webpackDevServerConfig;
}

module.exports = {
  overridePaths,
  overrideWebpackConfig,
  overrideWebpackDevServerConfig
};
 ```
## Multiple env configs for production build
[Create React App](https://github.com/Saranchenkov/create-react-app) allow only one `.env.production` config for `NODE_ENV="production"`. But this fork lets to create multiple `.env` files for production builds.

`Create React App` uses variable `NODE_ENV` to find env file, but this fork uses env `ENV_FILE` for these purposes. For example, if you set `ENV_FILE=stage`, webpack will use `.env.stage` env file.
If you don't set `ENV_FILE` variable, `NODE_ENV` will be used by default.
You can install `cross-env` package to set and use environment variables across platforms.

#### Example of npm scripts in `package.json`
```
"scripts": {
  "start": "react-scripts start",
  "build:stage": "cross-env ENV_FILE=stage react-scripts build",    // <-- .env.stage
  "build:production": "cross-env ENV_FILE=production react-scripts build",    // <-- .env.production
  "test": "react-scripts test",
  "eject": "react-scripts eject"
},
```


## Which version of `react-scripts` does this fork use ?
You can find config version at the field `react-scripts-version` of `package.json`.

---
_Source: https://npm.io/package/overridable-react-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
