I have a node module (IceJS) which insists on putting all of its exports, not in module.exports
, but in global
. In there a way to sandbox the module and take its global.ice
and return it as a normal node module, as in var ice = require("Ice");
?
Asked
Active
Viewed 42 times
1

Abex
- 300
- 5
- 11
-
are you asking how to modify the ice source to accomplish this? – Catalyst Jun 29 '14 at 06:55
-
No, I want to change where Ice puts itself, without modifying its source because that is nigh on impossible, as it has many files, all required in, modifying `global`, and not using CommonJS. – Abex Jun 29 '14 at 06:59
-
If ice isn't causing problems besides being in global you could just create a wrapper which requires it, then assigns the module.exports = global.iceproperty – Catalyst Jun 29 '14 at 07:05
-
A wrapper such as `require("Ice"); module.exports = global.ice;` keeps ice in global, even in the file requiring the wrapper. – Abex Jun 29 '14 at 07:10
-
looks like it is designed to work in browser (hence puts itself in a global object), so even if you managed to wrap it in a CommonJS module, it wouldn't work anyway – vkurchatkin Jun 29 '14 at 10:37
-
that has been fixed in latest release, Ice module are not longer global in NodeJS, https://www.npmjs.com/package/zeroc-icejs – José Jan 22 '15 at 10:18