Webpack Dev Server 在更新嵌套路由中的模块后不重新呈现
Webpack Dev Server not rerendering after updating a module in nested routes
我收到以下错误
Refused to execute script from 'http://localhost:8080/Docs/bundle.c2e76650.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
如果路径只有一层深度(例如localhost/docs)和react-router
,它似乎可以工作,但是一旦嵌套路由(例如localhost/docs/nestedRoute),它会导致热重装打破。这是我的 webpack.config.js
.
的相关快照
devServer: {
contentBase: "dist",
overlay: true,
historyApiFallback: true,
hot: true
},
webpack -> v4.1.1
webpack-dev-server -> v3.1.1
将以下内容添加到我的 webpack.config.js
中解决了问题...
{
...
output: {
...
publicPath: '/'
}
}
引用#978
我收到以下错误
Refused to execute script from 'http://localhost:8080/Docs/bundle.c2e76650.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
如果路径只有一层深度(例如localhost/docs)和react-router
,它似乎可以工作,但是一旦嵌套路由(例如localhost/docs/nestedRoute),它会导致热重装打破。这是我的 webpack.config.js
.
devServer: {
contentBase: "dist",
overlay: true,
historyApiFallback: true,
hot: true
},
webpack -> v4.1.1
webpack-dev-server -> v3.1.1
将以下内容添加到我的 webpack.config.js
中解决了问题...
{
...
output: {
...
publicPath: '/'
}
}
引用#978