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

Optional chaining et al #3469

Closed
dy opened this issue Mar 29, 2020 · 2 comments
Closed

Optional chaining et al #3469

dy opened this issue Mar 29, 2020 · 2 comments

Comments

@dy
Copy link

dy commented Mar 29, 2020

Browsers already support optional chaining, but rollup doesn't recognize the syntax:

[!] Error: Unexpected token
$.js (18:30)
16:         if (target.nodeType !== ELEMENT) return
17:         ;[target.classList.contains(SPECT_CLASS) ? target : null, ...target.getElementsByClassName(SPECT_CLASS)]
18:         .forEach(node => node?.[_spect].forEach(set => set.delete(node)))
                                  ^
19:       })
Error: Unexpected token
    at error (C:\projects\spect\node_modules\rollup\dist\shared\rollup.js:10120:30)

What's the right way to handle that? Hoped to avoid babel plugin.

@keithamus
Copy link
Contributor

@dy you might want to follow acornjs/acorn#891 which adds optional chaining to Acorn, the underlying parser rollup uses. Support for this will likely be blocked until Acorn gets it.

@dy dy changed the title Optional chaining et all Optional chaining et al Mar 29, 2020
@lukastaegert
Copy link
Member

This is available now in Rollup v2.11.0 via #3582

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

3 participants