# react-app-rewired-esbuild

> Use esbuild in your create-react-app

Latest version **0.0.11** (published 2022-05-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-app-rewired-esbuild
pnpm add react-app-rewired-esbuild
yarn add react-app-rewired-esbuild
bun add react-app-rewired-esbuild
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2022-05-30 |
| First published | 2021-10-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | fupengl |
| Maintainers | fupengl |
| Keywords | react-scripts, react-app, esbuild, react-app-rewired, customize-cra |

## Links

- npm: https://www.npmjs.com/package/react-app-rewired-esbuild
- Repository: https://github.com/fupengl/react-app-rewired-esbuild
- Homepage: https://github.com/fupengl/react-app-rewired-esbuild#readme
- Issues: https://github.com/fupengl/react-app-rewired-esbuild/issues
- npm.io page: https://npm.io/package/react-app-rewired-esbuild

## Dependencies (1)

- [esbuild-loader](https://npm.io/package/esbuild-loader.md) ^2.15.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.11 (latest) — 2022-05-30
- 0.0.10 — 2022-01-11
- 0.0.9 — 2021-10-07
- 0.0.8 — 2021-10-07
- 0.0.7 — 2021-10-07
- 0.0.6 — 2021-10-07
- 0.0.5 — 2021-10-07
- 0.0.4 — 2021-10-07
- 0.0.3 — 2021-10-07
- 0.0.2 — 2021-10-07
- 0.0.1 — 2021-10-07

## README

# react-app-rewired-esbuild

Use `esbuild` in your `create-react-app`.

`react-scripts` When the project grows, the compilation speed is slow, and the development uses `esbuild` to improve the compilation speed.

> It is recommended to use the development mode to ensure stability !!!

## Features

- Relpace `babel-loader` to `esbuild-loader` for faster build time
- Relpace `TerserPlugin` to `ESBuildMinifyPlugin` for faster build time

## Installation

```bash
npm i react-app-rewired-esbuild -D
```

## Usage

This project is based on [`react-app-rewired`](https://github.com/timarney/react-app-rewired).

```js
/* config-overrides.js */

const rewiredEsbuild = require("react-app-rewired-esbuild");

module.exports = function override(config, env) {
  // your config ...
  return rewiredEsbuild()(config, env);
};

// use `customize-cra`
const { override } = require("customize-cra");

module.exports = override(rewiredEsbuild());
```

## Options

specification [`esbuild-loader`](https://github.com/privatenumber/esbuild-loader)

### ESBuildLoaderOptions

Type: `object`  
Default:

```js
{
    loader: useTypeScript ? 'tsx' : 'jsx',
    target: 'es2015',
}
```

### ESBuildMinifyOptions

Type: `object`  
Default:

```js
{
    loader: useTypeScript ? 'tsx' : 'jsx',
    css: true,
}
```

### onlyMinimizer

Type: `boolean`  
Use only for minimizer. It is recommended to add this parameter to the production environment.

## FQA

### ReferenceError: React is not defined

Added react introduction in the first line of the error file,Originally, babel-plugin-react-app handled this situation, but esbuild did not.

### Why is it faster?

Originally, create-react-app was compiled with babel, and [esbuild](https://github.com/evanw/esbuild) would be faster to compile

## License

MIT © [fupengl](https://github.com/fupengl)

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