Len
Len

Reputation: 142

Webpack Build generates index.html but blank when loaded in browser

Please find my repo@ https://github.com/reachlinlen/empexplorer Webpack configuration is https://github.com/reachlinlen/empexplorer/blob/master/webpack.config.js

Why index.html is not rendering the pages after npm run build? Does Tailwind css is causing any issue?

Upvotes: 0

Views: 790

Answers (2)

Shin ShiBa
Shin ShiBa

Reputation: 31

I found another way to serve the webpack 5 build version.

In terminal

npm i -g http-server

cd dist && http-server

Now your build version should be on http://127.0.0.1:8080.

I hope this can help someone who is still bothering by this issue.

Upvotes: 0

Max Arzamastsev
Max Arzamastsev

Reputation: 535

All is good with your build (but don't forget to add "axios" in dependencies). You need to use a HashRouter instead of BrowserRouter if you want your application will work with static file server (like www.test.com/path/index.html).

https://github.com/ReactTraining/react-router/blob/master/FAQ.md#why-doesnt-my-application-render-after-refreshing

Upvotes: 1

Related Questions