+0
Daily
9,836
stars
418
forks
85
watchers
254
prs
418
issues
13
releases
README
ℹ️ Before submitting an issue to this repo - Ensure it's a issue with the code in this repo, not a how do I configure something with Webpack question (post something on Stack Overflow or Spectrum). It's your config you "own" it. - 🚨Version 2.0 removes the rewire helper functions - 中文版本说明 Tweak the create-react-app webpack config(s) without using 'eject' and without creating a fork of the react-scripts. All the benefits of create-react-app without the limitations of "no config". You can add plugins, loaders whatever you need. Rewire Your App ☠ As of Create React App 2.0 this repo is "lightly" maintained mostly by the community at this point. ⚠️ Please Note: By doing this you're breaking the "guarantees" that CRA provides. That is to say you now "own" the configs. No support will be provided. Proceed with caution. "Stuff can break" — Dan Abramov https://twitter.com/dan_abramov/status/1045809734069170176 Note: I personally use next.js or Razzle which both support custom Webpack out of the box. Alternatives You can try customize-cra for a set of CRA 2.0 compatible rewirers, or any of the alternative projects and forks that aim to support 2.0: - Rescripts, an alternative framework for extending CRA configurations (supports 2.0+). - react-scripts-rewired for a fork of this project that aims to support CRA 2.0 - craco How to rewire your create-react-app project Create your app using create-react-app and then rewire it. 1) Install react-app-rewired For create-react-app 2.x with Webpack 4: bash npm install react-app-rewired --save-dev For create-react-app 1.x or react-scripts-ts with Webpack 3: bash npm install [email protected] --save-dev 2) Create a config-overrides.js file in the root directory javascript / config-overrides.js / module.exports = function override(config, env) { //do stuff with the webpack config... return config; } +-- your-project | +-- config-overrides.js | +-- node_modules | +-- package.json | +-- public | +-- README.md | +-- src 3) 'Flip' the existing calls to react-scripts in npm scripts for start, build and test diff / package.json / "scripts": { - "start": "react-scripts start", + "start": "react-app-rewired start", - "build": "react-scripts build", + "build": "react-app-rewired build", - "test": "react-scripts test", + "test": "react-app-rewired test", "eject": "react-scripts eject" } Note: Do NOT flip the call for the eject script. That gets run only once for a project, after which you are given full control over the webpack configuration making react-app-rewired no longer required. There are no configuration options to rewire for the eject script. 4) Start the Dev Server bash npm start 5) Build your app bash npm run build Extended Configuration Options You can set a custom path for config-overrides.js. If you (for instance) wanted to use a 3rd-party config-overrides.js that exists in node_modules, you could add the fol
Top issues
#650when I run npm start I got some error its existing project i want to run in my system 4 comments · 2023-09-03#653Stuck on Creating an optimized production build...3 comments · 2023-10-30#652How to debug react app in VSCode3 comments · 2023-10-11#644Build Failed using react-app-rewired3 comments · 2023-02-22#658npm run build doesn't exit after successful completion2 comments · 2024-07-02#632Getting CRA error when trying to run jest test runner after installing recat-app-rewired2 comments · 2022-10-04#630Trouble to start the dev server2 comments · 2022-09-18#626Conflicting peer dependency: [email protected]2 comments · 2022-05-27
Latest release
2.2.1 v2.2.1 2022-02-15https://github.com/timarney/react-app-rewired/pull/606 Add /config folder to package.json files array