Maybe something like (totally not sure if this is doable or if it's even a good idea):
NativeModule.wrapper = [
'(function (require, module, __filename, __dirname) { const exports = module.exports; ',
'\n});'
];
The reasoning for this is to give users a warning if they try to change the exports variable reference.
-1 I don't think any benefit provided by this outweighs the breakage this would cause.
Not a good idea, exports = module.exports = function MyClass() {}; is common, why would we want to break that?
Please don't. Many of npm packages will be doomed after this obscure change. 馃拃
I'll close, too disruptive.
Most helpful comment
Not a good idea,
exports = module.exports = function MyClass() {};is common, why would we want to break that?