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

Conflicting variables generated from mix of regular and default module exports #2752

Closed
mislav opened this issue Mar 15, 2019 · 2 comments · Fixed by #2758
Closed

Conflicting variables generated from mix of regular and default module exports #2752

mislav opened this issue Mar 15, 2019 · 2 comments · Fixed by #2758

Comments

@mislav
Copy link
Contributor

mislav commented Mar 15, 2019

  • Rollup Version: 1.6.0
  • earliest affected Rollup version: 1.2.0
  • Operating System (or Browser): macOS 10.14.3
  • Node Version: v10.8.0

How Do We Reproduce?

Clone https://github.com/mislav/rollup-shadowing and run npm it.

Basically, there are two source files:

//# src/index.js
import './foo'

//# src/foo.js
export function foo() {
  return "foo"
}

export default function() {
  return "default"
}

Note the mix of a normal export and a default export from the foo.js module.

Expected Behavior

Generating a rollup bundle from src/index.js yields no conflicting variable/function names.

Actual Behavior

The generated rollup bundle has two conflicting declarations of function foo() { ... } in the same scope:

//# dist/index.js
function foo() {
  return "foo"
}

function foo() {
  return "default"
}

This was discovered by pulling in dependencies from d3-geo and d3-shape modules, both of which have sub-modules which mix normal exports with default exports.

/cc @lukastaegert #2689

@lukastaegert
Copy link
Member

It seems my previous example was wrong as this was just a basic parse error. The actual issue was that default exports were not always properly included when not tree-shaking. Fix at #2758

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.

2 participants