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

traverse crashes on ES dynamic import #97

Open
dgoldstein0 opened this issue Oct 24, 2018 · 4 comments
Open

traverse crashes on ES dynamic import #97

dgoldstein0 opened this issue Oct 24, 2018 · 4 comments

Comments

@dgoldstein0
Copy link

the es8 (7? 9? not sure exactly which number it is, but it's stage 4 now I believe) style import("foo") crashes estraverse. In particular:

  • use a parser that produces an estree spec AST and understands this syntax. I discovered this with cherow, but I suspect acorn will also work
  • estraverse.traverse(ast, {enter: function(){}, leave: function(){}}); should probably then be enough to repro if there's a dynamic import in the tree

I expect estraverse to be able to handle the type: "Import" nodes, and it instead throws. This seems to happen when it tries to visit the children of these nodes, as a this.skip() in the enter function when an import node is encountered does the trick. That said, skipping it's children shouldn't be necessary.

@seasonli
Copy link

seasonli commented Nov 14, 2018

Try using fallback=iteration

@dgoldstein0
Copy link
Author

what is that? I don't see iteration documented at all

@seasonli
Copy link

image

@dgoldstein0
Copy link
Author

dgoldstein0 commented Nov 14, 2018 via email

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

2 participants