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

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


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.



error image



Any ideas?





can we see how you access these resources in your App? Maybe related to this and that.
– v-gael
Jul 26 at 6:16





i basically replaced the local URL, which pointed to the original React folder, to the new folder in the server. src="./public_html/static/js/main.f5239b39.js"
– Enrico
Jul 26 at 6:18







you changed the minified version of your index html to point script adresses somewhere else on the server ?
– Jayffe
Jul 26 at 6:24





Check if your <stylesheet> and <javascript> element have the expected type
– v-gael
Jul 26 at 6:25




<stylesheet>


<javascript>


type





@Jayffe, yes, I addressed on the server folder which is named public_html, where I stored the applicaton itself
– Enrico
Jul 26 at 9:46




2 Answers
2



Just edit webpack config by editing this:


devServer: {
historyApiFallback: true
}



And also add this to public/index.html:


<base href="/" />



Hope this help





Do you mean the webpack string in the package.json? if not, where? also, do you mean i should enclose every href in the base tag?
– Enrico
Jul 26 at 13:10







Webpack configuration in webpack.config file and you need to change base tag only in index.html file not every file
– Adnan shah
2 days ago



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.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty