The configuration works like this:
In the create-react-app
build all code files should be under the /source
directory. All static files should be under the /public
directory, and they can be referenced from base url(for example: if I have a file /public/my-image.png
, I can use it in my JSX with <img src = '/my-image.png
.
To answer your question, this is not just with create-react-app
, but with any JavaScript project. If a folder has a index.js
file, you don't have to specify ./dir/index.js
and instead can do ./dir
, which looks for a file called index.js
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…