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

[!] (plugin commonjs--resolver) RollupError: Identifier "fn" has already been declared #5247

Closed
coderaiser opened this issue Nov 12, 2023 · 4 comments · Fixed by #5248
Closed

Comments

@coderaiser
Copy link

coderaiser commented Nov 12, 2023

Rollup Version

4.4.0

Operating System (or Browser)

mac os

Node Version (if applicable)

v20.9.0

Link To Reproduction

https://github.com/putoutjs/bundle

Expected Behaviour

Build without errors

Actual Behaviour

image

Everything works good with Rollup v4.3.1

@sapphi-red
Copy link
Contributor

@lukastaegert
Copy link
Member

lukastaegert commented Nov 13, 2023

Interesting. So this forbidden:

var fn;
function fn(){};

but this is allowed:

function foo() {
  var fn;
  function fn(){};
}

So if I understand this, the reasoning is that inside a function, the var is hoisted beyond the body scope maybe into the "parameter scope", which is why function and var in the second example are not considered to be in the same scope.

@lazka
Copy link

lazka commented Nov 13, 2023

I'm getting the same error since the update from 4.3.1 to 4.4.0:

[!] (plugin commonjs--resolver) RollupError: Identifier "Vt" has already been declared
node_modules/jspdf/dist/jspdf.es.min.js (236:40507)

let me know if I should provide more info.

Copy link

This issue has been resolved via #5248 as part of rollup@4.4.1. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants