DEV Community

loading...

Package alias name using NPM/yarn

abdelrahmanahmed profile image Wahdan Updated on ・1 min read

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 😎

Discussion

pic
Editor guide