Is viewing a built create-react-app over the file:// protocol intended to be supported? I'm ultimately trying to develop an Electron app, but at this point I'm simply pointing Chrome to file://{path-to-project}/build/index.html and getting blank white screen instead of my app starting.
I've checked:
index.html correctly by webpack. I had to set "homepage": "./" in my package.json to achieve this.<html lang="en">
<head>
...
<link href="./static/css/main.463eda6b.css" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="./static/js/main.bd32b483.js"></script>
</body>
</html>
npm start works greathttp-server ./buildThis turns out to be an issue with react-router, <BrowserRouter> doesn't play nice with the file:// protocol and failed silently. Simply switching to <MemoryRouter> solved the issue.
Technically <MemoryRouter> worked in that it didn't fail, but my application needed to use URL arguments so I opted for <HashRouter> instead.
So far so good...
Most helpful comment
This turns out to be an issue with
react-router,<BrowserRouter>doesn't play nice with thefile://protocol and failed silently. Simply switching to<MemoryRouter>solved the issue.