I'm developing ReactJs Application.I'm getting page not found (404) error when i hard refresh the build page.but its work fine (page routing) with button click.
index.js
ReactDOM.render(<Provider store={store}>
<BrowserRouter>
<div>
<div className="wrapper">
<Switch>
<Route path="/" exact component={Home} />
<Route path="/profile" component={Profile} />
<Route path="/faq" component={Faq} />
<Route path="/privacy" component={Privacy} />
</Switch>
</div>
</div>
</BrowserRouter>
</Provider>, document.getElementById('root'));
webpack.config.js
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'bundle.js',
publicPath: '/'
},
devServer: {
port: 3000,
historyApiFallback: true
},
}
i got this error,when i tried to run my build bundle.but it's work charmly when i run npm start
.
(404 got when run build app)