[Yarn] Use Yarn to Create an Alternative Import Name of an Installed Library
to of name an create use import library
2023-09-14 09:00:51 时间
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.
相关文章
- What is "found.000" ? How to deal with it?
- how to get geometry type of layer using IMapServer3 and IMapLayerInfo? (C#)
- [Typescript] Map an Object to a Union of Tuples
- [Typescript] 45. Medium - MinusOne (Solution to solve max number of iteration by tail call)
- [AWS Amplify] Deploy Your React Application to AWS Using the Amplify CLI
- [Angular] Configure Anuglar CLI to generate inlineTemplate and inlineStyle
- [HTML5] Add Semantic Styling to the Current Page of a Navigation Item with aria-current
- [React] Use React.cloneElement to Extend Functionality of Children Components
- [React] React Fundamentals: Introduction to Properties
- 大叔经验分享(53)kudu报错unable to find SASL plugin: PLAIN
- 配置无线网络的时候会提示“Enter Password for Default Keyring to Unlock”
- [Angular] Use ngx-build-plus to compile Angular Elements
- [Algorithm] Dynamic programming: Find Sets Of Numbers That Add Up To 16
- [Node.js] Pass command line arguments to node.js
- Follow me to learn how to use mvc template
- how to create BRF function via code
- 【异常】Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)
- 使用gridlayout布局后,因某些原因又删除,并整理文件夹结构时,Unable to resolve target 'android-7'
- ORA-06553:PLS-306:wrong number or types of arguments in call to ''
- 3GPP TS 29244-h20 中英文对照 | 5.13.5 Reporting of UE MAC addresses to the SMF
- 问题解决:Error: non-absolute URLs should be in form of repo_name/path_to_chart, got: my-ghost