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

--format=iife option erases variables defined multiple times #2098

Closed
melpon opened this issue Mar 12, 2022 · 1 comment
Closed

--format=iife option erases variables defined multiple times #2098

melpon opened this issue Mar 12, 2022 · 1 comment

Comments

@melpon
Copy link

melpon commented Mar 12, 2022

test.js:

var x = 10;
console.log(x);
var x = 20;

Output from the esbuild --format=iife test.js command:

(() => {
  console.log(x);
  var x = 20;
})();

The former program outputs 10, while the latter outputs undefined. Is this behavior intended?

@melpon
Copy link
Author

melpon commented Mar 12, 2022

I found #2080. It seems to same problem.

melpon added a commit to melpon/legacy-modes that referenced this issue Mar 12, 2022
blockKeywords is defined twice.
When using a script converted with esbuild, the first blockKeywords is deleted due to issue evanw/esbuild#2098.
To address this issue, rename the first blockKeywords definition to blockKeywordsStr.
marijnh pushed a commit to codemirror/legacy-modes that referenced this issue Mar 13, 2022
blockKeywords is defined twice.
When using a script converted with esbuild, the first blockKeywords is deleted due to issue evanw/esbuild#2098.
To address this issue, rename the first blockKeywords definition to blockKeywordsStr.
@evanw evanw closed this as completed in ea3b3d3 Mar 13, 2022
JRaspass added a commit to code-golf/code-golf that referenced this issue Mar 14, 2022
Looks like the cause of the breakage was a duplicate var in codemirror
(fixed upstream, not yet released) and a bug in esbuild (fixed in this
bump) - evanw/esbuild#2098
zhusjfaker pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
hardfist pushed a commit to speedy-js/esbuild that referenced this issue Mar 28, 2022
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

1 participant