capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.37k stars 200 forks source link

Cannot use import statement outside a module #320

Open jakobrosenberg opened 2 years ago

jakobrosenberg commented 2 years ago

Am I required to bundle dependencies or is there a way to support dynamic imports with happy-dom?

capricorn86 commented 2 years ago

Hi @jakobrosenberg! :slightly_smiling_face:

Yes this is a feature I have been thinking about adding as I also have a need for it. Not sure exactly when I will get the time to add it, but I will do it as soon as possible.

jakobrosenberg commented 2 years ago

That sounds amazing!

If there's anything I can do to help, let me know. 🙂

jakobrosenberg commented 2 years ago

Any news on this? Still happy to help.

capricorn86 commented 2 years ago

@jakobrosenberg sorry for a late answer. It has been a lot in my private and working life.

This is not that easy to implement, but definitely something I want to do when the major bugs has been cleared up.

denniseffing commented 1 month ago

We just ran into this issue as well. Due to this issue, we are not able to write unit tests using vitest and @testing-library/dom. Not even jsdom supports this https://github.com/jsdom/jsdom/issues/2475 😢 .