您的位置:首页 > 其它

[Yarn] Use Yarn to Create an Alternative Import Name of an Installed Library

2017-06-13 01:22 477 查看
In this lesson we'll show how to use yarn to alias the names of same npm libraries but install different versions. This could allow for easy migrating from one library version to an upgraded version.

You can install lib by using Yarn and give the lib an alias name:

yarn add lodash3@npm:lodash^3  // install lodash version 3
yarn add lodash4@npm:lodash^4  // install lodash version 4


Then you can use it:

import lodash3 from 'lodash3';
import lodash4 from 'lodash4';


Note: it only works when you and your team use Yarn, npm won't work.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐