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

Illegal redeclared variable: global #3

Closed
aidam38 opened this issue Nov 4, 2021 · 9 comments
Closed

Illegal redeclared variable: global #3

aidam38 opened this issue Nov 4, 2021 · 9 comments

Comments

@aidam38
Copy link

aidam38 commented Nov 4, 2021

I'm getting an error when trying to compile this in a ClojureScript project that looks like this:

Closure compilation failed with 1 errors
--- node_modules/@lezer/php/dist/index.cjs:50
Illegal redeclared variable: global

Here's a branch of a repo that replicates the error. I don't have time to check if this happens in a JS project too.

@marijnh
Copy link
Contributor

marijnh commented Nov 4, 2021

There's no restriction in JavaScript against declaring a variable named global, so I'd say this is a problem with ClojureScript.

@aidam38
Copy link
Author

aidam38 commented Nov 5, 2021

Yes, we renamed the variable to _global manually and it started working. :P

@iansinnott
Copy link

This is a problem with google/closure-compiler (discovered via google/closure-compiler#2471).

@marijnh
Copy link
Contributor

marijnh commented Dec 20, 2021

Right. Closing this, since I don't plan to accommodate it on this side.

@marijnh marijnh closed this as completed Dec 20, 2021
@felixsanz
Copy link

felixsanz commented Sep 13, 2022

@marijnh so.. this gives an error and make the package unusable, what can we do?

PS: im not using clojure, just js + vite

@marijnh
Copy link
Contributor

marijnh commented Sep 13, 2022

what can we do?

Figure out what's going wrong, possibly open a new bug if you think this package is to blame. Declaring a variable named global locally is valid JavaScript, so I suspect you're using some build/runtime tool that is broken.

@felixsanz
Copy link

what can we do?

Figure out what's going wrong, possibly open a new bug if you think this package is to blame. Declaring a variable named global locally is valid JavaScript, so I suspect you're using some build/runtime tool that is broken.

i changed globalfor _global and it works. can I submit a PR? I'm using typescript, node and vite, nothing special

@marijnh
Copy link
Contributor

marijnh commented Sep 13, 2022

I really don't want to adjust code to work around bugs, especially untriaged bugs, in other software.

@felixsanz
Copy link

I really don't want to adjust code to work around bugs, especially untriaged bugs, in other software.

what other software? typescript/vite you mean? there is already a lot of variables that start with _, like _interface, so why not just have another? why you want this grammar to break when no other does? It's just changing a variable name that doesn't affect anything.

I can help you debug the issue if you guide me or tell me what you need, but I'm using node, not a weird broken runtime. I don't understand why you don't want to fix this. It's easy and doesn't cause any trouble.

10:20:34 AM [vite] Internal server error: Identifier 'global' has already been declared

I don't know where the problem really is, but all the things I'm using are so popular, so i'm not the last one encountering this issue.

If you don't want to fix the grammar, it's ok.

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