partytown
partytown copied to clipboard
[🐞] partytown-sw.js The script does not have a MIME type
Describe the bug
I am trying to integrate Partytown in my website and following the HTML integration. And have included partytown.js as inline script in
. And have configured window.partytown with correct path for "lib".Since partytown.js requests the partytown-sw.js, In chrome browser network tab I get 200 status for partytown-sw.js,
But in console it throws error:
DOMException: Failed to register a ServiceWorker for scope ("https://www.example.com/static/js/src/partytown/lib/") with script ("https://www.example.com/static/js/src/partytown-sw.js"): The script does not have a MIME type
I checked if there is any issue in the path of file but that's not the case, as going to link https://www.example.com/static/js/src/partytown-sw.js
gives the correct JS file in browser.
I definitely think this issue is related to Partytown service worker file, as I came accross a blog where some author mentioned above same MIME type
issue with the loading of Partytown Service Worker file.
Blog link: https://maxchadwick.xyz/blog/experimenting-with-partytown
(I tried with latest version of Partytown, it still has this error)
Any quick help or fix or workaround on this is highly appreciated!!
Reproduction
https://maxchadwick.xyz/blog/experimenting-with-partytown
Steps to reproduce
- Do HTML integration for Partytown
- Include partytown.js as inline script in
- Now go to Chrome/Firefox browser and load the website
- Check the console, it will throw error that partytown-sw.js file doesn't have a MIME type.
(I only tried the latest Partytown version, not sure about old versions)
Browser Info
Chrome, Firefox
Additional Information
No response
The mime type is controlled by your server... I think you need to configure it?