I want to use the ip-address library with SystemJS (note, this question may look similar, but this is another problem that I encountered when trying to complete this task).
The library IP address is dependent on util-deprecate. He imports it as follows:
var util = require('util');
And then uses it as follows:
Address4.prototype.toV6Group = util.deprecate(Address4.prototype.toGroup6, 'deprecated: `toV6Group` has been renamed to `toGroup6`');
When I import the ip address into the node project as ...
var ipAddress = require('ip-address');
... then I have no problem.
When I import an ip address into a SystemJS project ...
System.import('ip-address');
... then I get the error message:
util.deprecate is not a function
How to configure SystemJS to perform this import? I am currently setting it up so ...
const map: any = { 'ip-address':'vendor/ip-address', 'util':'vendor/util-deprecate' } const packages: any = { 'ip-address': {main:'ip-address.js'}, 'util': {main: 'browser'} };
To save the search, util.des util-deprecate file here , it exports the deprecate function directly.
Note. I can make this work if I change the ip-address module so that all calls have the form:
Address4.prototype.toV6Group = util(Address4.prototype.toGroup6, 'deprecated: `toV6Group` has been renamed to `toGroup6`');
I would prefer not to modify a third-party library if I can avoid it.