Fix/Support module scripts in local development with fdk

Request: Please fix usage of module scripts in local development with fdk

When loading scripts with type module:

<script type="module" src="./assets/index.js"></script>

the following error is thrown due to the wrong content type “text/html” being set for the response by the express server.

Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Solution: In fdk folder lib/routes/iframe.js change line 167 to:

return res.type('application/javascript').send(script);

then the response content type is set correctly to ‘application/javascript’. :+1:t3:

Hi @juliankleine can you please share the zip file, we need to look at a few more details.

Thanks!

Hi @juliankleine,

Thanks for reporting the issue.

I have reported it as a bug with the team. I will keep you posted on any updates. We don’t have an ETA on the fix yet.

Hi @Debjani

There is no need for a zip file. If you wish to simulate this just add type module to the script imports and it will fail.

best,
Julian

Thanks @Raviraj !
I hope this gets accelerated as I have provided the fix as well.
Have a good one

1 Like