robbestad/react-iframe

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

Closed this issue · 0 comments

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!