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

[Bug] Get "ReferenceError: _toConsumableArray is not defined" when use ... #25

Closed
xachary opened this issue Nov 25, 2021 · 4 comments
Closed
Labels
bug Something isn't working contribution welcome Good for newcomers Priority: P4

Comments

@xachary
Copy link

xachary commented Nov 25, 2021

Current behavior

ReferenceError: _toConsumableArray is not defined.

Expected behavior

No ReferenceError.

Usage

{{ [...document.querySelectorAll('div')] }}
@xachary xachary changed the title [Bug] Please describe your issue [Bug] Get "ReferenceError: _toConsumableArray is not defined" when use ... Nov 25, 2021
@JuniorTour
Copy link
Owner

JuniorTour commented Nov 25, 2021

It is a bug.

Currently Babel will transform [...document.querySelectorAll('div')] into:

function _toConsumableArray(arr) {
  // ...
}

_toConsumableArray(document.querySelectorAll("div"));

But this compiler will drop _toConsumableArray directly, So your error occured.

Babel Playground DEMO Link


May be we can fix it by add "arrayLikeIsIterable": true to assumptions, according to babel-plugin-transform-spread Doc.

Do you have interest to fix this issue and become our Contributor?

You can:

  1. Try to reproduce this error. Setup DEMO Project can help.

  2. Follow CONTRIBUTING.md to make a Pull Request.

@JuniorTour JuniorTour added bug Something isn't working contribution welcome Good for newcomers and removed need triage labels Nov 25, 2021
@JuniorTour
Copy link
Owner

JuniorTour commented Nov 28, 2021

We just publish a beta version 1.0.7-beta.0 which will fix the error _toConsumableArray is not defined.

You can try it by yarn add vue-template-babel-compiler@beta.

Thanks for your feedback again!

@JuniorTour JuniorTour reopened this Dec 1, 2021
@JuniorTour
Copy link
Owner

We just publish a beta version 1.0.7-beta.0 which will fix the error _toConsumableArray is not defined.

You can try it by yarn add vue-template-babel-compiler@beta.

1.0.7-beta.0 did't fix this error, I will look into this deeply.

@JuniorTour
Copy link
Owner

We just publish v1.1.2, it will fix this issue,

Try it by:

npm install vue-template-babel-compiler@latest
// or 
yarn add vue-template-babel-compiler@latest

Thanks for your feedback again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contribution welcome Good for newcomers Priority: P4
Projects
None yet
Development

No branches or pull requests

2 participants