A
A
Andrew2017-03-16 01:04:18
React
Andrew, 2017-03-16 01:04:18

How to setup webpack-dev-server using historyApiFallback?

If you navigate through the application pages through Link from react-router, then everything is loaded, but if you manually enter any path other than the root path into the url, you get the following picture: zsgd4Sxm9N4.jpgwebpack.config.js
package.json
repo
What's the problem? How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Drapeza, 2017-03-16
@undefined_title

Webpack starts looking for files in the wrong path, adds /movie/ at the beginning in your screen.
I can't say exactly what the problem is, let's try this:
First, replace output.filename: './dist/main.js'with:

output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist')
    }

And publicPath: '/dist/'on:
And select css like this - new ExtractTextPlugin('[name].css'), output.path already indicates that everything should be unloaded in dist

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question