nate
nate•15mo ago

Using with create react app

what is the propper way to use with CRA? https://docs.convex.dev/client/react/quickstart-create-react-app Module not found: Error: You attempted to import ../convex/_generated/api which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
Create-React-App Quickstart | Convex Developer Hub
Add Convex to a Create React App project
12 Replies
erquhart
erquhart•15mo ago
If you follow the guide, the convex directory should be inside of your src/ directory Looks like you have it in repository root
nate
nateOP•15mo ago
No description
nate
nateOP•15mo ago
what am i missing?
erquhart
erquhart•15mo ago
The convex directory is supposed to be inside of the src directory I'd suggest deleting your my-app directory and walking through the instructions again. I've just confirmed that if you follow the instructions, your convex directory will end up inside of your src directory.
nate
nateOP•15mo ago
i also did it from scratch after your first message, will try again looks like i have to select "new project" from the cli. as exiting project didn't set it up right
erquhart
erquhart•15mo ago
oh interesting
nate
nateOP•15mo ago
looks to work now
erquhart
erquhart•15mo ago
trying with an existing project
nate
nateOP•15mo ago
i manually added the file generated from the new path
{
"functions": "src/convex/"
}
{
"functions": "src/convex/"
}
then moved my code into and that seemed to do it at least it seems to 🤞
erquhart
erquhart•15mo ago
Confirmed, first run of npx convex dev in a CRA app generates src/convex/ if a new convex project is created, but generates convex/, if an existing project is selected.
Indy
Indy•15mo ago
Ah interesting. I'll file file an internal bug to investigate. Thanks for raising this!
ballingt
ballingt•15mo ago
Thanks for reporting, nate; and for reproing, erquhart!

Did you find this page helpful?