chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.77k stars 455 forks source link

Refused to execute script (from xyz) because its MIME type ('text/js') is not executable. #313

Closed bfalchuk closed 5 years ago

bfalchuk commented 5 years ago

I am seeing a new error on Windows10 desktop Chrome (but not Firefox on same platform, strangely) using physi.js. Anyone have insights as to this relationship between the worker and ammo.js.. and the cryptic MIME message, or how to avert this ?

My page is here: https://d1gs9wmn0hg2ut.cloudfront.net/main.html

Error:

`physijs_worker.js:243 Refused to execute script from 'https://d1gs9wmn0hg2ut.cloudfront.net/js/ammo.js' because its MIME type ('text/js') is not executable.

The line is in and around usage of params.ammo

public_functions.init = function( params ) {
    importScripts( params.ammo );

    _transform = new Ammo.btTransform;
    _vec3_1 = new Ammo.btVector3(0,0,0);
    _vec3_2 = new Ammo.btVector3(0,0,0);

Also seeing this:

physijs_worker.js:243 Refused to execute script from 'https://d1gs9wmn0hg2ut.cloudfront.net/js/ammo.js' because its MIME type ('text/js') is not executable. public_functions.init @ physijs_worker.js:243 self.onmessage @ physijs_worker.js:1396 physijs_worker.js:243 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://d1gs9wmn0hg2ut.cloudfront.net/js/ammo.js' failed to load. at Object.public_functions.init (https://d1gs9wmn0hg2ut.cloudfront.net/js/physijs_worker.js:243:2) at self.onmessage (https://d1gs9wmn0hg2ut.cloudfront.net/js/physijs_worker.js:1396:35)

bfalchuk commented 5 years ago

Hmm. sorry folks - resolving this for now as closed, no comment needed. Looks like this is an esoteric AWS S3 error - it wanted to serve up the ammo.js file as text/js which was the wrong MIME type.. I believe this is resolved on my side (in case you'd like to know) by changing the file(s) types application/javascript and, for Chrome, this makes things work.