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 imports when using shared: true #308

Closed
Conduitry opened this issue Feb 28, 2017 · 2 comments · Fixed by #314
Closed

Duplicate imports when using shared: true #308

Conduitry opened this issue Feb 28, 2017 · 2 comments · Fixed by #314
Labels
Milestone

Comments

@Conduitry
Copy link
Member

Conduitry commented Feb 28, 2017

The new import deconflicting in 1.7.1 does not appear to be working correctly with shared helpers. I'm running

svelte.compile('anything', { shared: true })

and this is outputting code that begins with

import { get, fire, observe, on, set, _flush, dispatchObservers, createElement, detachNode, insertNode, createText, appendNode, noop, get, fire, observe, on, set, _flush } from "svelte/shared.js"

Several named imports are being included twice.

@Conduitry Conduitry changed the title Duplicate imports when using shared: true Duplicate imports when using shared: true Feb 28, 2017
@Rich-Harris
Copy link
Member

Ah, of course — it's because as of 76663f9, helpers are added to generator.uses here, meaning they're being duplicated here.

Aside from that, have just realised that dispatchObservers isn't being handled the same way as other helpers.

@Conduitry
Copy link
Member Author

Conduitry commented Feb 28, 2017

const names = [ 'get', 'fire', 'observe', 'on', 'set', '_flush', 'dispatchObservers' ].concat( Object.keys( generator.uses ) )

generator.uses should probably be merged with that existing array.

edit: I was a little too slow on that Comment button 😄

@Rich-Harris Rich-Harris added this to the ASAP milestone Mar 1, 2017
Rich-Harris added a commit that referenced this issue Mar 1, 2017
Rich-Harris added a commit that referenced this issue Mar 1, 2017
prevent duplicate imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants