Webpack-dev-server how to remove default routing for react app?
up vote
2
down vote
favorite
I'm using webpack-dev-server for running my reactJS application. I want to implement own router (for learning purposes), but webpack-dev-server intercepts pathname of url and return 404 error. How to remove or fix this ? I just want to processing urls' pathname by own route component and remove processing of router with webpack-dev-server.
My webpack.config.js
module.exports = {
entry: "./src/app.js",
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
reactjs webpack webpack-dev-server
add a comment |
up vote
2
down vote
favorite
I'm using webpack-dev-server for running my reactJS application. I want to implement own router (for learning purposes), but webpack-dev-server intercepts pathname of url and return 404 error. How to remove or fix this ? I just want to processing urls' pathname by own route component and remove processing of router with webpack-dev-server.
My webpack.config.js
module.exports = {
entry: "./src/app.js",
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
reactjs webpack webpack-dev-server
1
I'm not quite sure I understand your question, but maybe you want to sethistoryApiFallback
totrue
?
– Tholle
Nov 11 at 15:02
1
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm using webpack-dev-server for running my reactJS application. I want to implement own router (for learning purposes), but webpack-dev-server intercepts pathname of url and return 404 error. How to remove or fix this ? I just want to processing urls' pathname by own route component and remove processing of router with webpack-dev-server.
My webpack.config.js
module.exports = {
entry: "./src/app.js",
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
reactjs webpack webpack-dev-server
I'm using webpack-dev-server for running my reactJS application. I want to implement own router (for learning purposes), but webpack-dev-server intercepts pathname of url and return 404 error. How to remove or fix this ? I just want to processing urls' pathname by own route component and remove processing of router with webpack-dev-server.
My webpack.config.js
module.exports = {
entry: "./src/app.js",
module: {
rules: [
{
test: /.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
reactjs webpack webpack-dev-server
reactjs webpack webpack-dev-server
edited Nov 11 at 14:59
asked Nov 11 at 14:53
Sergio Ivanuzzo
1,03931137
1,03931137
1
I'm not quite sure I understand your question, but maybe you want to sethistoryApiFallback
totrue
?
– Tholle
Nov 11 at 15:02
1
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08
add a comment |
1
I'm not quite sure I understand your question, but maybe you want to sethistoryApiFallback
totrue
?
– Tholle
Nov 11 at 15:02
1
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08
1
1
I'm not quite sure I understand your question, but maybe you want to set
historyApiFallback
to true
?– Tholle
Nov 11 at 15:02
I'm not quite sure I understand your question, but maybe you want to set
historyApiFallback
to true
?– Tholle
Nov 11 at 15:02
1
1
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You can set historyApiFallback
to true
and the server will respond with the index.html
page instead of 404
.
webpack.config.js
module.exports = {
//...
devServer: {
historyApiFallback: true
}
};
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You can set historyApiFallback
to true
and the server will respond with the index.html
page instead of 404
.
webpack.config.js
module.exports = {
//...
devServer: {
historyApiFallback: true
}
};
add a comment |
up vote
2
down vote
accepted
You can set historyApiFallback
to true
and the server will respond with the index.html
page instead of 404
.
webpack.config.js
module.exports = {
//...
devServer: {
historyApiFallback: true
}
};
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You can set historyApiFallback
to true
and the server will respond with the index.html
page instead of 404
.
webpack.config.js
module.exports = {
//...
devServer: {
historyApiFallback: true
}
};
You can set historyApiFallback
to true
and the server will respond with the index.html
page instead of 404
.
webpack.config.js
module.exports = {
//...
devServer: {
historyApiFallback: true
}
};
edited Nov 11 at 15:19
answered Nov 11 at 15:10
Tholle
33.4k53558
33.4k53558
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249905%2fwebpack-dev-server-how-to-remove-default-routing-for-react-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I'm not quite sure I understand your question, but maybe you want to set
historyApiFallback
totrue
?– Tholle
Nov 11 at 15:02
1
@Tholle yes, that's it! Thanks a lot, if you add your comment as answer - I will accept it.
– Sergio Ivanuzzo
Nov 11 at 15:08