Answer the question
In order to leave comments, you need to log in
How to setup webpack-dev-server?
There are routes
<Route exact path="/" component={Home} />
<Route exact path="/users" component={Users} />
<Route
exact
path="/users/create"
component={UserCreate}
/>
<Route
path={"/users/edit/:id"}
component={UserEdit}
/>
<Route component={NotFound} />
config.devServer = {
contentBase: path.resolve(__dirname, "public"),
compress: false,
port: 9000,
historyApiFallback: {
index: "index.html"
}
};
output: {
path: path.resolve(__dirname, "public", "build"),
filename: "bundle.js",
publicPath: "/build/"
},
Failed to load resource: the server responded with a status of 404 (Not Found)
Cannot GET /users/edit/build/bundle.js
Answer the question
In order to leave comments, you need to log in
config.devServer = {
contentBase: path.resolve(__dirname, 'build'),
compress: false,
port: 9000,
historyApiFallback: true,
};
output: {
path: path.resolve(__dirname, 'build'),
filename: 'bundle.js',
publicPath: '/',
},
localhost:9000/bundle.js
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question