-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to use modules with type="text/partytown" #195
Comments
At this time we'll hold off on this feature request since at this time web workers do not have have full support for ES module: https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker |
It seems Safari already supports ESM, and the only one remaining is Firefox 😬 Question: when ESM is fully supported, would that mean a module script could run |
Seems like Firefox supports ESM since the 6th of June. Shouldn't this be reopened @adamdbradley? |
Is your feature request related to a problem? Please describe.
I would like to try Partytown with some internal libraries that we are using with type="module" and nomodule.
But the point is that if I include the
type="text/partytown"
then, when they are loaded they have been included as regular scripts. And it doesn't work.I received this error in the console: SyntaxError: Cannot use import statement outside a module.
Describe the solution you'd like
Be able to use partytown with module and nomodule scripts.
Describe alternatives you've considered
I think that I can provide you an idea about a possible solution. When you do the replacement of these assets on the page you can look for the extension and if the file ends with
.esm.js
is a module. If not, it's a nomodule.The text was updated successfully, but these errors were encountered: