-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Description
There's this odd bug I'm encountering where using process.env.PUBLIC_URL to link to pdf's in the public folder doesn't work consistently with react-router. It will work fine on localhost, but the moment I deploy it live, the link to the pdf works only once or twice before failing and going to a 404 page.
Also not sure if this bug lies here or with react-router, I couldn't find any reference on their repo. Sorry if it's the wrong spot.
Has anyone else encountered this? For now I'm serving the pdf from within src, but really dislike the complicated path and hash produced by file-loader, so might have to end up ejecting...
I'd also like to note this worked in prior versions of create-react-app as seen here: #775
Is this a bug report?
Yes
Environment
node -v: 8.4.0npm -v: 5.6.0react-scripts: 1.0.11react-router: 4.2.0react-router-dom: 4.2.2
Steps to Reproduce
- Add file to public
- Reference it in code using
{process.env.PUBLIC_URL + "path to file"} - Create a build and deploy
- Click link several times, notice that it stops working
Expected Behavior
Consistently open the file
Actual Behavior
Routed to 404 after using link once.