[NPM] Test npm packages locally in another project using npm link
We will import our newly published package into a new project locally to make sure everything is working as expected. We can do this locally before publishing with npm link. This creates a symbolic link in our node_modules folder, so our unpublished local package is used like an installed published package. This is important because it lets us test making changes to our package and using them immediately without publishing and updating a package with each change we want to test. This is good practice to do before publishing a new version of a package.
Using npm link is easy:
1. Create you own project and cd to it.
2. Inside project run:
npm link <target_project_name>
<target_project_name> is from package.json name.
3. The important thing to remember that, inside target project, we have to mark that:
"main": "build/index.js",
It should point to the build folder or "dist" folder depends on your project.
4. Everytime you change code inside target project, you need to run trigger "build" runs again:
"dev": "watch 'npm run build' src",
[NPM] Test npm packages locally in another project using npm link的更多相关文章
- npm不能安装任何包,报错:npm WARN onload-script failed to require onload script npm-autoinit/autoinit及解决方法
想要利用Hexo搭建一个博客,但是安装时npm一直报错,不仅仅是Hexo包,连别的其他包也不行,会提示下面的一堆错误 npm WARN onload-script failed to require ...
- npm缺少css-loader,/style-compiler,stylus-loader问题,npm没有权限无法全局更新问题【已解决】
ERROR in ./node_modules/css-loader!./node_modules/vue-loader/lib/style-compiler?{"vue":tru ...
- npm 模块开发调试技巧之最优方案npm link
在我们平时写项目中,当我们需要新开发或修改的 npm 模块时,如何在本地项目中调试呢? 本地项目路径:G:\npm\project 开发的模块路径:G:\npm\model 方法一: 在cmd命令窗口 ...
- NuGet Packages are missing,This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.
错误内容 This project references NuGet package(s) that are missing on this computer. Use NuGet Package R ...
- 使用npm安装包失败的解决办法(使用npm国内镜像介绍)
镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在): 1.通过config命令 npm config set registry https://regist ...
- 【npm start 启动失败】ubuntu 将node和npm同时更新到最新的稳定版本
https://blog.csdn.net/u010277553/article/details/80938829 npm start 启动失败,报错如下 错误提示 make sure you hav ...
- npm上发布包和删除已发布的npm包(https://www.npmjs.com/)
1.npm上发布自己写的包 2.删除已经发布的包 npm unpublish --force //强制删除,这个是撤销24小时发布的包,有些包发布久了,这个方法不会再管用了. npx force-un ...
- [NPM] Create a node script to replace a complex npm script
In this lesson we will look at pulling out complex npm script logic into an external JavaScript file ...
- [NPM] Create a bash script to replace a complex npm script
In this lesson we will look at pulling out complex npm scripts into their own external bash scripts. ...
随机推荐
- Visual Studio Code Setup
Windows https://code.visualstudio.com/docs/setup/windows Additional Components and Tools https://cod ...
- zzulioj--1089--make pair(dfs+模拟)
1809: make pair Time Limit: 1 Sec Memory Limit: 128 MB Submit: 60 Solved: 44 SubmitStatusWeb Board ...
- kafka查询topic属性含义
第一行,列出了topic的名称,分区数(PartitionCount),副本数(ReplicationFactor)以及其他的配置(Config.s) Leader:1 表示为做为读写的broker的 ...
- 分享一个正则 选择html中所有的单标签
var str = /\B<.+?>/g;
- Debian9.5 配置x11vnc远程桌面
x11vnc是一个VNC服务器,它允许用户远程查看并用任何VNC查看器与真实的X显示器(即与物理监视器,键盘和鼠标相对应的显示器)进行交互.虽然它的原作者Karl Runge不再开发,但LibVNC和 ...
- xfce4 + docky ,docky 上面那透明的一条黑色横线去掉方法
在安装完Debian 9 + xfce4桌面后 ,添加docky启动后,会在docky 上面有一条黑色横线看起来非常不舒服. 去掉方法:设置管理器->窗口管理器微调->合成器->取消 ...
- python 多线程探索
前面已经了解过了,python多线程效率较低的主要原因是存在GIL,即Global Interpreter Lock(全局解释器锁).这里继续详细的看下GIL的说明与如何避免GIL的影响,从而提高py ...
- 推荐学习《Python与量化投资从基础到实战》PDF及代码+《量化投资以Python为工具》PDF及代码
利用python分析量化投资问题是现在研究的热点,推荐两份资料用于学习 <Python与量化投资:从基础到实战>主要讲解如何利用Python进行量化投资,包括对数据的获取.整理.分析挖掘. ...
- Struts(18)标签
控件标签 Struts 2 的标签有一组标签.更easy控制流程页面运行.下面是重要的Struts2控制标签列表: if /else 标签: 这些标签运行可在每一种语言找到的一种基本条件流程. 'If ...
- 20160227.CCPP体系具体解释(0037天)
程序片段(01):01.一对一模式.c+02.中介者模式.c+03.广播模式.c 内容概要:事件 ///01.一对一模式.c #include <stdio.h> #include < ...