Need for ejecting create-react-app
See original GitHub issueI tried using this box this past weekend at ETHWaterloo but ended up just cherry picking the code I needed instead. There were 2 mains reasons for this:
- We had already committed some contract code to a bare
truffle init
project and couldn’t use theunbox
command as a result - After looking at the repo I wanted to avoid ejecting
create-react-app
The solution we came up with was to create a new react app in a client
directory inside the truffle app. This solves the issue of create-react-app
and truffle both using a build
directory in the same folder. We did run into an issue that create-react-app doesn’t allow importing code from outside of its own src
directory which we solved with a symlink.
Here is our project for reference: https://github.com/kevinhughes27/ticket-wicket src directory with symlink https://github.com/kevinhughes27/ticket-wicket/tree/master/client/src
Were there any other reasons for ejecting create-react-app
? It will be easier to maintain the box if create-react-app
doesn’t need to be ejected.
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (8 by maintainers)
Top GitHub Comments
@gre if you are not opposed to Next.js, I’ve created a Truffle Box to work around this: https://github.com/adrianmcli/truffle-next
Yeah I literally copy and pasted the exact same thing + the getWeb3.js from the utils folder. The Web3 object initializes correctly, I tested that out.
I also made sure to install Web3 and truffle-contract. Literally the only difference should be the fact that it’s not an ejected project (or maybe I’m missing a dependency?). I’ll make a repo and post it here ago tho, thanks for taking a quick look.