DEV Community

Wahdan
Wahdan

Posted on • Updated on

Package alias name using NPM/yarn

Have you ever tried to install a package under an alias? you can do this using NPM or yarn. Lets try to rename lodash package to another name.

with NPM:

npm install yourPackageName@npm:lodash --save

with yarn:

yarn add yourPackageName@npm:lodash

Now you can import your aliased package with

const yourPackageName = require('yourPackageName');

Happy hack week 😎

Top comments (0)