Modules/Natives
Contents
How Modules relate to Global Natives
Currently as of Modules 1.1 the spec for how an environment chooses to implement native classes in Modules is "undefined". That means it's up to each environment implementation to decide how it should work.
"""To a developer "undefined" means that you cannot count on any specific behavior. If you take advantage of an "undefined" behavior, that means that there's a chance that behavior could break in the future, or break on a different platform. If you don't monkey with the globals, your app will work fine across CommonJS implementations (barring other, unrelated, compatibility issues of course)""" — Kevin Dangoor
There's no way of knowing what will happen if you modify a native from inside a Module. So how would you safely go about doing it according to the current spec?
How to do it now
Example of how to extend prototypes using a CommonJS Module
Can this change in the future?
Proposal for explicit native use in Modules