my website doesn’t load properly but it loads as it should when I host it from my PC
http://odindk.rf.gd
Welcome
I see that the page is trying to load this:
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
Free hosting does not support server-side JavaScript.
I checked your website and I see the same issue.
But when I open my browser developer tools and check the Console, I see the following error:
Loading module from “http://odindk.rf.gd/src/main.jsx” was blocked because of a disallowed MIME type (“”).
We had the same issue on another site a few months ago, which you can see in this topic:
If I check the final posts, it looks like the issue was caused .jsx
files being raw TypeScript source code, which browsers do not understand. You need to run NPM on your own computer to compile your React app to regular Javascript instead, and then upload those built files.
i have run npm install. and build but if i anct host on your host this okay
You cannot host TypeScript code here, you have to compile and build it on your computer, then upload the result. Free hosting cannot do that for you.
what if i buy ?
Node.js hosting is supported on premium hosting, but that tick means you can run Node.js server side applications (like Express).
The thing is that you don’t just need to have access to Node.js, you also need to think about how you deploy your code to it. Even hosting that supports Node.js won’t automatically see that you’re uploading Typescript files and run your NPM build step to compile your code on the fly. PHP works like that, but Javascript does not.
Whenever you update your code, you need to make sure the npm run build
step is run. Having Node.js on the hosting server adds some options, but you’ll still need to setup your own deploy pipeline.
And please note that while premium hosting does support Node.js, it does not provide SSH access for you to run commands on the server.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.