Netlify react app magical wiring

Hi,

netlify-cli/2.63.3 darwin-x64 node-v14.8.0
npm 6.14.8

Here is a simple hello world:

~/src/ $ mkdir my-project && cd my-project
~/src/my-project/ $ npx create-react-app react-app
~/src/my-project/ $ cd react-app
~/src/my-project/ $ netlify init -m
~/src/my-project/ $ netlify dev

Note: netlify init -m is followed by default choices (manual), I can’t find a way to successfully specify it on the cli.

This serves a bare react app magically without specifying a netlify.toml file.
How does netlify dev infer from the content of react-app that it needs to somehow serve a react app and not some index.html?
The log contains “Starting Netlify Dev with create-react-app” as if it’s hardcoded in netlify-cli, this is what I suppose since I can’t find an appropriate result when I grep create-react-app.

Bonus: how can I easily and successfully debug / trace what is happening when running netlify dev? I’m thinking of just placing breakpoints in the source.
(When I try netlify dev --debug I get an exception right away YAMLException: unacceptable kind of an object to dump [object Undefined])

Hey @jt-xx,
Here’s where you can see the magical log line:

How do we determine settings.framework? We use this detector:

and then set the detector’s result equal to framework. Let us know if you have any other questions on this!

Thank you Jen, I should have dug a little further.
So it’s indeed hardcoded in detectors/create-react-app.js .

1 Like