robbestad / react-iframe

Simple solution for using iframes in React
ISC License
434 stars 79 forks source link

Issue serving built CRA app with <Iframe src="./public/myfile.html"> #73

Closed tnrich closed 4 years ago

tnrich commented 4 years ago

Hey there, I'm just leaving this in case other people are running into the issue I was.

I was building a CRA app and trying to serve an html file in the /public dir like so

<Iframe url={"./public/myfile.html"} position="absolute" width="100%" height="100%" />

this worked fine when I was running create-react-app locally, but when I tried to serve the build with serve -s ./build I got a weird error where it was serving the original index.html inside of the iframe instead of myfile.html

After some digging I realized that I needed to drop the -s option!

-s, --single                        Rewrite all not-found requests to index.html

this worked just fine:

serve ./build

Cheers!