简体   繁体   中英

MIME type checking failure when deploying the React App on the server

I am deploying my React app on a public server but when I open it I just get the blank page.

In order to deploy the app I did:

1) run "npm run build" to minify the code and putting into a build folder
2) replaced the local URL in the new index.html file with the correct server ones.

still, when trying to open the website in the console I get these errors.

错误图片

Any ideas?

Just edit webpack config by editing this:

     devServer: {
       historyApiFallback: true
          }

And also add this to public/index.html:

  <base href="/" />

Hope this help

I solved the problem simply correcting the url.

since I was already accessing the "public" folder thanks to the "./" typing in the beginning of the url, there was no need to type "./public".

Thank you anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM