Create-react-app: How to setup local dependencies to test local changes to react-scripts

Created on 22 Sep 2018  路  2Comments  路  Source: facebook/create-react-app

I need to make a tweak to react-scripts/config/webpackConfigDev.config.js (specifically just this change: https://github.com/laran/create-react-app/commit/f4a241aed8620837dec92ee5012e56069a8a8b0b) and then use that locally. I've pulled down a local copy and wrestled for an entire day with npm link, yarn link, lerna and yalc to try to set my own project to depend on my local clone of create-react-app, but I've been unable to get it to work properly.

I'm probably missing something simple. But what I've done so far always has some of the dependencies among the local copies of the create-react-app packages unsatisfied and my app then throws errors when trying to load a script usually from react-dev-utils, react-error-overlay or babel-plugin-named-asset-import.

A simple walkthrough or set of instructions would be super helpful. My apologies if I just missed something super simple. But some simple instructions would be super helpful. Thanks!

question

All 2 comments

In the monorepo, clean everything up, run yarn and let Yarn Workspaces do its thing. Link react-scripts up via:

$ # monorepo root
$ git clean -fdx
$ cd packages/react-scripts/
$ yarn link # if yarn complains about already being linked, run `yarn unlink` followed by `yarn link` again

Go to your package you want to test in and wipe node_modules, run yarn, and link to react-scripts:

$ # your project folder
$ rm -rf node_modules/
$ yarn
$ yarn link react-scripts

Let me know if you need more help!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aranir picture Aranir  路  3Comments

barcher picture barcher  路  3Comments

fson picture fson  路  3Comments

jnachtigall picture jnachtigall  路  3Comments

alleroux picture alleroux  路  3Comments