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. 解决 Ubuntu 下解压 .zip 文件时出现乱码

    Ubuntu 下解压含中文名的 .zip 文件时,有时候会出现乱码的情况.我们可以通过下列命令来解决此类问题: $ unzip -O CP936 xxx.zip 原文网址 http://www.cnb ...

  2. 洛谷——P1525 关押罪犯

    https://www.luogu.org/problem/show?pid=1525 题目描述 S 城现有两座监狱,一共关押着N 名罪犯,编号分别为1~N.他们之间的关系自然也极不和谐.很多罪犯之间 ...

  3. ORA-01653 无法在表空间扩展的解决办法 -- 增加表空间大小或给表空间增加数据文件

    转自原文 ORA-01653 无法在表空间扩展的解决办法 -- 增加表空间大小或给表空间增加数据文件 当前系统的数据量越来越大的,昨天还运行正常的数据库,突然无法使用了.经过定位发现是"OR ...

  4. Android 多种方式正确的载入图像,有效避免oom

    图像载入的方式:        Android开发中消耗内存较多一般都是在图像上面.本文就主要介绍如何正确的展现图像降低对内存的开销,有效的避免oom现象. 首先我们知道我的获取图像的来源一般有三种源 ...

  5. eclipse个人插件

    1.SVN eclipse markets 安装m2e-subversion.svnkit 2.maven 本地装好mvn prefences导入maven安装目录和配置 3.单元测试覆盖率 EclE ...

  6. alert警告框

    标签中写: <div class="alert alert-warning fade in"> <button class="close" d ...

  7. 提高IIS的FTP安全性 管理员的九阴真经

    提高IIS的FTP安全性 管理员的九阴真经 <九阴真经>是很多武林高手蒙昧以求的武林秘籍,在系统管理员这个武林中也有很多类似<九阴真经>一样的秘籍.在这里就向大家介绍一下有关提 ...

  8. ByteUtils

    package sort.bing.com; import java.io.ByteArrayOutputStream;import java.io.DataOutputStream;import j ...

  9. go pointer

    go pointer package main import "fmt" type Mutatable struct { a int b int } func (m Mutatab ...

  10. Vue 打包后报错 Uncaught TypeError: Cannot redefine property: $router

    原因:就如报错提示所描述的,不能重新定义$router,说明是重复定了$router.通常是因为在项目中安装了vue-router的依赖并且用Vue.use()使用了vue-router,还在inde ...