score:1

Accepted answer

you could try this package https://github.com/nargonath/cra-build-watch

install it and add the script to your package.json

{
  "scripts": {
    "watch": "cra-build-watch"
  }
}

and run it

npm run watch

more info here

https://ibraheem.ca/writings/cra-write-to-disk-in-dev/

and if you go to the react repo issue linked in the article you would find more workarounds

score:3

tl;dr

run npm run build, not npm run start

more detail

react-scripts start runs webpack-dev-server internally. as a default setting, webpack-dev-server serves bundled files from memory and does not write files in directory. if you want to write files with webpack-dev-sever, you could set writetodisk option to true in your dev server configuration.

however, i dont think this is what you want to serve on firebase emulator. webpack-dev-server does not build optimal app for production, and you also need to use react-app-rewired to customize dev server configuration in cra template.

what you want to do is npm run build to run react-scripts build, which builds optimized production app in /build directory.


Related Query

More Query from same tag