#MIME type error

3 messages · Page 1 of 1 (latest)

bright moat
#

I am trying to make simple app with create-react-app typescript. I wanted to make web worker for some heavy computation task and I created new .ts file for it. But as soon as I created a file, I get an error saying that it's wrong MIME type. After some research I realised that error is showing because it's expecting it to be a HTML page, but this is no HTML page.
If I put .ts file in src folder then it's throwing me an error about disallowed MIME type ("text/html"), but if I put in a public folder then it shows disallowed MIME type (“video/mp2t”).

I am not really sure how to solve this, as these middleware things aren't my strong suit.

Also I am using Win10 and localhost is on Express.js as far as I could understand it.

Thanks in advance...

remote cosmos
#

The first error sounds like it's happening because the file is not accessible at that location. The second error sounds like you're trying to run TypeScript code directly in the browser. You need to compile your TypeScript code before you can run it in the browser.

bright moat
#

Any idea how can I fix that?

Isn't code already compiled when I run it localy in localhost? I already built some components and they are working properly, it's just these files with just ts that are not working. this_is_fine