react 修改了文件后,或者手动刷新后,老是出现404,找不到文件。
错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
user:1 Refused to execute script from 'http://localhost:8081/system/js/index.1dfb94a7fa2c6e5b.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
commonfile.1dfb94a7fa2c6e5b.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
user:1 Refused to execute script from 'http://localhost:8081/system/js/commonfile.1dfb94a7fa2c6e5b.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
解决办法:
在devServer中定义historyApiFallback:true,
并且,其output中要定义 publicPath:'/',
这样,就能解决刷新404问题了。