Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

All loaders share importPromises #212

Closed
justinbmeyer opened this issue Sep 13, 2014 · 2 comments
Closed

All loaders share importPromises #212

justinbmeyer opened this issue Sep 13, 2014 · 2 comments

Comments

@justinbmeyer
Copy link
Contributor

All loaders should not share importPromises. importPromises, like the modules registry should be unique to a given loader.

This bug exposes itself in the following scenario:

Creating multiple loaders and using them to load the same module, but have different fetch or normalize behavior:

loader1 = new Loader({ ... })
loader2 = new Loader({ ..., fetch: function(){  //different behavior  }  })

If loader1 and loader2 are used to import the same module at approximately the same time, loader2's fetch will not be called:

loader1.import('foo')
loader2.import('foo')

As far as I know, loader1 and loader2 should share nothing. Let me know if you agree and I can create a pull request moving importPromises onto _loader or somewhere else. Thanks!

@unscriptable
Copy link

👍

@guybedford
Copy link
Member

Well caught - I've included a fix on master.

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

No branches or pull requests

3 participants