How can I configure my react application so I do not need to specify index on my imports?
-src
|- app.jsx
|- views
|- sample
|- sample.css
|- sample-container.jsx
|- sample-view.jsx
|- index.jsx
Currently I have to do this:
import Sample from "src/views/sample/index"
What I want to do is this:
import Sample from "src/views/sample"
I used create-react-app
for initial set up and already ran npm run eject
Looks to be an issue with creating new index.jsx
file while the server is started. Shutting down the server and starting it back up ( npm start
) seems to resolve the issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.