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

named import fails with treeshaking #1077

Open
pYr0x opened this issue Sep 26, 2018 · 1 comment
Open

named import fails with treeshaking #1077

pYr0x opened this issue Sep 26, 2018 · 1 comment

Comments

@pYr0x
Copy link
Contributor

pYr0x commented Sep 26, 2018

see this test repo. https://github.com/pYr0x/import-bug

i have two files, both imported from "d3-axis".
the first one imported {axisLeft, axisBottom} and the second one imported {axisLeft, axisTop}.

you see that axisBottom and axisTop is different.
Using the build script

npm run build` with treeshaking throw an error `(node:3700) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: 'axisBottom' is not exported by d3-axis@1.0.12#src/index
(node:3700) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

but d3-axis really exports axisBottom

export {
  axisTop,
  axisRight,
  axisBottom,
  axisLeft
} from "./axis";

but without treeshaking, the build is successfully.

@matthewp
Copy link
Member

Looked into this. Not totally sure what is going on. We use a slightly old version (maybe a few months) of rollup for tree-shaking, I wonder if there was a bug in that old version. I'd be interested to see what happens in their latest version. Could just be a matter of upgrading.

Longer term I'd like to get rid of the rollup dependency since it doesn't fit super well with what steal-tools does (it moves dependencies around, for example) and since steal does tree-shaking on its own I'd rather just improve that rather than maintain 2 separate tree-shaking sources of bugs.

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

No branches or pull requests

2 participants