-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Dynamic import of native ES modules for async components causes error #6751
Comments
Removing the check wouldn't fix this, it will only break existing usage on transpiled modules. What we need is a way to check if an object is a native module object from a dynamic import. |
I mean just remove the check for i.e. change this
To this:
|
That's not safe enough IMO. This would break if the user somehow defines a custom option called |
Note the same fix needs to be in |
Version
2.4.4
Reproduction link
https://github.com/anthonygore/vue-dynamic-import
Steps to reproduce
Must use a browser where dynamic module import is supported e.g. the latest Safari or Chrome Canary.
What is expected?
Async component should load and auto-resolve module
What is actually happening?
Uncaught error "Cannot add property _Ctor, object is not extensible".
As of v2.4.0, ES modules are auto-resolved when used as dynamic components e.g.
However, this only works if the module has been transpiled from ES to CommonJS since it checks for the flag
__esModule
. It does not work for native ES modules where the flag is not present.If you agree, I could easy put in a PR to remove the check for
comp.__esModule
on line 15 of resolve-async-component.js, which would solve the issueThe text was updated successfully, but these errors were encountered: