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^  // install lodash version 3
yarn add lodash4@npm:lodash^ // 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.

[Yarn] Use Yarn to Create an Alternative Import Name of an Installed Library的更多相关文章

  1. Hadoop Yarn配置项 yarn.nodemanager.resource.local-dirs探讨

    1. What is the recommended value for "yarn.nodemanager.resource.local-dirs"? We only have ...

  2. Dream Spark ------spark on yarn ,yarn的配置

    <?xml version="1.0"?> <!-- Licensed under the Apache License, Version 2.0 (the &q ...

  3. yarn add & yarn global add

    yarn global add & add -D https://yarnpkg.com/zh-Hans/docs/cli/add#toc-commands $ yarn global add ...

  4. Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition.

    第一行忘记加分号 pragma solidity ^0.4.0;

  5. Yarn import now uses package-lock.json

    转发自: https://yarnpkg.com/blog/2018/06/04/yarn-import-package-lock/?utm_source=tuicool&utm_medium ...

  6. yarn import 使用package-lock.json

    yarn 1.7(目前最新的版本)支持npm 的package-lock.json 了 环境准备 安装更新yarn sudo npm install -g yarn 查看版本 yarn version ...

  7. npm init & npx create & yarn create

    npm init & npx create & yarn create https://create-react-app.dev/docs/getting-started/#creat ...

  8. Spark On YARN启动流程源码分析(一)

    本文主要参考: a. https://www.cnblogs.com/yy3b2007com/p/10934090.html 0. 说明 a. 关于spark源码会不定期的更新与补充 b. 对于spa ...

  9. 大数据学习笔记之Hadoop(三):MapReduce&YARN

    文章目录 一 MapReduce概念 1.1 为什么要MapReduce 1.2 MapReduce核心思想 1.3 MapReduce进程 1.4 MapReduce编程规范(八股文) 1.5 Ma ...

随机推荐

  1. 【2017 Multi-University Training Contest - Team 2】 Regular polygon

    [Link]: [Description] 给你n个点整数点; 问你这n个点,能够组成多少个正多边形 [Solution] 整点只能构成正四边形. 则先把所有的边预处理出来; 枚举每某两条边为对角线的 ...

  2. Jenkins学习总结(2)——Jenkins+Maven进行Java项目持续集成

    最近配置了Jenkins服务器,记录下基本过程.(当然还遇到了若干小问题,兵来将挡水来土掩就是了) Jenkins安装 安装Tomcat 从Jenkins官网下载jenkins.war文件.官网地址: ...

  3. leetcode -day29 Binary Tree Inorder Traversal &amp; Restore IP Addresses

    1.  Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' ...

  4. 实战c++中的vector系列--copy set to vector(别混淆了reserve和resize)

    stl算法中有个copy函数.我们能够轻松的写出这种代码: #include <iostream> #include <algorithm> #include <vect ...

  5. samba-设定文件共享

    家里有两台电脑,一台装的是window,一台装的是ubuntu.一直想要实现两台电脑资源共享,今天终于成功实现了. smaba 具体简介就不说了,反正就知道,它可以创建一个服务器,然后让其他的电脑共享 ...

  6. ubuntu-12.04工作区内容变换所属工作区

    最近一直纠结于ubuntu12.04窗口更改所属工作区问题,今天在网上看到了方法.记录下来 主要就是利用快捷键. 1.打开你想移动的窗口 2.使用快捷键Shift + Ctrl + Alt + Dow ...

  7. <meta-data>的使用

    在AndroidManifest.xml中,<meta-data>元素可以作为子元素,被包含在<activity>.<application> .<servi ...

  8. npm install (让别人下载自己的包)

    好几天没更新了,再这里跟大家说声抱歉,今天来点干货. 发布一个包在npm上,可以供世界所有人使用,想一下,以前我们做项目,都是在npm install 别人的包,什么时候才能install我们自己的包 ...

  9. Java学习笔记二.2

    5.运算符:变量的意义就在于可以进行运算,运算需要用运算符来表示,分为以下几种 class test { public static void main(String[] args) { //赋值运算 ...

  10. Office GVLK 密钥对照表(kms激活专用)

    Office2016系列: Office Professional Plus 2016:XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99 Office Standard 2016:JNRGM ...