Skip to content
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 parsing throws 'import' and 'export' may only appear at the top level #809

Closed
xsurge83 opened this issue Feb 21, 2019 · 4 comments

Comments

@xsurge83
Copy link

xsurge83 commented Feb 21, 2019

The following change is throwing an error for dynamic module imports.
image. Setting topLevel flag to null in parseStatement function which raises the

"'import' and 'export' may only appear at the top level"

Dynamic module import use to work in 5.7.3 with same settings.

I'm using angular-cli to compile my app which updated webpack to 4.29.9 with new acorn changes. Not sure if this is an angular-cli, webpack or acorn issue but after debugging I noticed these differences in acorn.

@michael-ciniawsky
Copy link

webpack/webpack#8656

@adrianheine
Copy link
Member

Apparently this is again an npm issue. @marijnh Maybe we can come up with a workaround for these issues? When developing plugins it's also pretty difficult to make sure that all plugins are using the same acorn tree. Putting tokTypes, TokenType, version and isIdentifierStart on the class would be enough for my plugins to not directly depend on acorn.

@marijnh
Copy link
Member

marijnh commented Aug 12, 2020

I think the Parser.acorn hack covers this problem too, no?

@adrianheine
Copy link
Member

yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants