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

removed unused variable and cause syntax error of bind function #3950

Closed
arthurlz opened this issue Feb 4, 2021 · 5 comments · Fixed by #3951
Closed

removed unused variable and cause syntax error of bind function #3950

arthurlz opened this issue Feb 4, 2021 · 5 comments · Fixed by #3951

Comments

@arthurlz
Copy link

arthurlz commented Feb 4, 2021

I am building a js library which requires a 3rd library lottie, and it has the following code

var wiggle = function wiggle(){}.bind(this)

But after I import it and build it, I got error in the line below

function wiggle(){}.bind(this)

uncaught syntaxerror unexpected identifier '.'

download the zip from repl and build it then open the dist/index.html , you could find this error.

Could you please tell me how can I avoid this

Expected Behavior

var wiggle = function wiggle(){}.bind(this)

Actual Behavior

function wiggle(){}.bind(this)
@kzc
Copy link
Contributor

kzc commented Feb 4, 2021

Same issue with object literals:

$ rollup -v
rollup v2.38.4

$ echo 'var x = {log: console.log}.log(123);' | rollup --silent | node
[stdin]:1
{log: console.log}.log(123);
                  ^
SyntaxError: Unexpected token '.'

@kzc
Copy link
Contributor

kzc commented Feb 4, 2021

and classes:

$ echo 'var a = class C{ static f(x){console.log(x)} }.f(123);' | rollup --silent | node
[stdin]:1
class C{ static f(x){console.log(x);} }.f(123);
                                       ^
SyntaxError: Unexpected token '.'

@lukastaegert
Copy link
Member

Yes, I noticed. Working on a fix but might take a day.

@matthewp
Copy link

matthewp commented Feb 4, 2021

Introduced in this change: #3933

@lukastaegert
Copy link
Member

Fix at #3951

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

Successfully merging a pull request may close this issue.

4 participants