Prevent local dependencies to escape to global scope

Hi @voronianski ,

I don't expect this PR to be merged like that: it is more a spike. As I told to you on Twitter I get all the dependencies set on the global scope where I expected them to be "local" to the function so I quickly hacked a little bit to get that fixed. I found this solution but it reduces the supported browser.

Is it what you wanted to do?