0.0.11 • Published 2 years ago

react-app-rewired-esbuild v0.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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

npm i react-app-rewired-esbuild -D

Usage

This project is based on react-app-rewired.

/* 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

ESBuildLoaderOptions

Type: object
Default:

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

ESBuildMinifyOptions

Type: object
Default:

{
    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 would be faster to compile

License

MIT © fupengl

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago