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

Duplicate import declarations #77

Closed
ericf opened this issue Aug 11, 2015 · 4 comments
Closed

Duplicate import declarations #77

ericf opened this issue Aug 11, 2015 · 4 comments

Comments

@ericf
Copy link
Contributor

ericf commented Aug 11, 2015

When rolling up multiple files that reference an external module (React in this case) I ended up with the following invalid ES6 import statement:

import { createElement, Component, createElement, isValidElement, Component, DOM, Component, DOM, Component, DOM, Component, DOM, Component, cloneElement, isValidElement, Component, Component, PropTypes, PropTypes, PropTypes, PropTypes, PropTypes, PropTypes, PropTypes, PropTypes } from 'react';

Note the duplicate import declarations… it appears these aren't being de-duped.

@Victorystick
Copy link
Contributor

That ain't right. Thank you for raising the issue!

Rich-Harris added a commit that referenced this issue Aug 16, 2015
@Rich-Harris Rich-Harris mentioned this issue Aug 16, 2015
@yairEO
Copy link

yairEO commented Nov 29, 2015

I am using Gulp to bundle all files in a folder and generate some file which has X amount of exports (from each file in the folder), the reason is so I could do something like this:

import * as controllers from 'controllers_bundle';

which will import all my controllers' functions so I won't have to manually write each import for each controller.

Anyway, when then gulp task combines the files, I get one big file which has many import declaration which repeat themselves since those controller files are mostly importing the same files themselves.

I then get a Duplicate declaration error on my bash console and my everything stops. I would think Rollup would be smart enough to internally check if an imported file has in itself duplicate import declarations and remove them...

@eventualbuddha
Copy link
Contributor

@yairEO that doesn't sound like the same issue as was fixed here. Could you open another issue with some sample code that reproduces the problem you're seeing?

@yairEO
Copy link

yairEO commented Nov 29, 2015

@eventualbuddha - sure, I will do that, hold on. But with the same title as this..?
Seems like the title of this issue should be more specific

opened new issue - #331

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

4 participants