Provide the ability to alias package names in order to substitute one dependency for another.
npm install nom-de-plume --save
In your package.json
file
{
"alias": {
"underscore": "lodash",
"react": "preact-compat",
"react-dom": "preact-compat"
}
}
Or in an .aliasrc
file
{
"underscore": "lodash",
"react": "preact-compat",
"react-dom": "preact-compat"
}
require('nom-de-plume');
const react = require('react'); //Preact instead
const _ = require('underscore'); // lodash
const ndp = require('nom-de-plume');
const react = require('react'); //Preact instead
const _ = require('underscore'); // lodash
ndp.clear(); // will remove the aliased lookups
const underscore = require('underscore'); //actually underscore