i18next / i18next-gitbook

165 stars 172 forks source link

Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. #84

Closed J-eno closed 5 years ago

J-eno commented 5 years ago

I tried importing i18next and the backend into my project after installing it from npm, but when I run my project on a local server, I keep getting: Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec. image

jamuhl commented 5 years ago

are you bundling using webpack...or trying a setup with browser modules directly?!?

J-eno commented 5 years ago

I haven't bundled anything. If I'm being honest, I don't know what I'm doing.

jamuhl commented 5 years ago

so what you expect me todo?

J-eno commented 5 years ago

This is your library, correct? I'm trying to see if you've seen this error before. I set it up the same way I saw it in the documentation. Am I missing something? Am I meant to bundle it using a webpack?

jamuhl commented 5 years ago

the samples there (https://www.i18next.com/overview/getting-started#basic-sample) are with "modern web" in mind (and you should see that if somewhat familiar with web development)

every sample there has a old school fiddle like: https://jsfiddle.net/jamuhl/dvk0e8a9/#tabs=js,result,html

jamuhl commented 5 years ago

So no - never saw that - seems your doing either something very new or something very wrong 😁

J-eno commented 5 years ago

Yeah, I followed every sample I saw on the documentation, but the browser keeps having problems with my 'import backend' line. I'm going to bet I'm doing something very wrong 😂

jamuhl commented 5 years ago

you can't import like that...that only works using webpack or similar module bundler: https://webpack.js.org/ (so react, angular, vue or similar - but not just plain browser)

J-eno commented 5 years ago

It worked after I bundled it. Thanks a lot! If I'm getting new errors ($(...).i18n is not a function) should I open a new thread and close this one?

jamuhl commented 5 years ago

I would suggest asking implementation / general how to questions over at stackoverflow...github issues are meant for issues were a module has a bug or you request a new feature. It's not a place to ask for implementation guidance or development assistance (as much i would like to help everyone maintaining OSS is taking a lot of unpaid time which means time from my family - so i can't do free support / teaching - hope that is understandable)

J-eno commented 5 years ago

I understand completely. You've been very helpful man. Thank you and enjoy your day.

sc-varraj commented 2 years ago

Failed to load angular build dist folder js files getting mime type error..

sc-varraj commented 2 years ago