-
Notifications
You must be signed in to change notification settings - Fork 108
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
Skypack bundle cannot be loaded in the browser #489
Comments
With version 7.0.1 when the Skypack instructions were added to the readme, it still works. I suppose the conversion to ESM destroys the conditional import here? |
oooh, good catch! We have not caught this, nor do we have a test for it. we could still do an async Or ... well. It can be done, sort of, but it will be a bit hacky:
Which is not great, as I assume most/many consumers will be using this in ESM, in which @mroderick I think you would be interested in this. @SimenB Any ideas? Fixing conditional imports like this would trigger a breaking API change in Jest, right? I am guessing someone has some clever ideas somewhere. |
@fatso83 nothing is stopping us from doing top-level |
No ... but I am not sure how that works. I usually try to map these newer constructs over to how this would look in ES5, but I cannot see how this works without introducing a Promise that leaks out into the exported module. But maybe there is? Totally not sure, so I will glady be informed 😅 |
Gah, this was hard, Ben. I have tried out top-level await , but getting that and CJS to work together was non-trivial, so it ended up just being a ESM conversion. Did not get anywhere. I think this will have to wait until @mroderick does a full ESM conversion? |
Just to add some details on why this is not moving:
So AFAIK, the only way of avoiding exposure of some Promise is moving the entire module to ESM, which I did here: This opens up a can of worms, as we should not do this without being prepared to convert Sinon as well. |
It's not the only way, btw. We can re-introduce a bundler (which was removed in #345), which could simply create a bundle where those modules were not available, which is what is done in I'd still much prefer having an ESM module, though that would force our hand to do the same for the main Sinon project. |
What did you expect to happen?
FakeTimers module is loaded.
What actually happens
An error is logged and the module does not load:
How to reproduce
Go to https://output.jsbin.com/xijaquyico and open the JavaScript console to see the error. The module is loaded like this:
The text was updated successfully, but these errors were encountered: