[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. ...
随机推荐
- angularjs之手机输入法回车变搜索,并触发事件,兼容pc回车事件
一.效果:回车按钮变搜索 之前的输入法: 之后的输入法: 二.功能实现 <input type="search" id="search_input" pl ...
- 2D上下文
js中说明的上下文表示的意思为C++中作用域(个人理解),因此2D上下文说明的是这个2D的作用域 像素:用来描述图片清晰度的小矩阵 填充和描边 填充:context.fillStyle = " ...
- shell中IF的用法介绍
一.语法结构 if [ condition ] then statements [elif condition then statements. ..] [else ...
- Maven学习总结(19)——深入理解Maven相关配置
MAVEN2的配置文件有两个settings.xml和pom.xml settings.xml:保存的是本地所有项目所共享的全局配置信息,默认在maven安装目录的conf目录下,如果没有安装mave ...
- MySQL事务(event scheduler)的学习【事务创建之后,没有运行的问题】
[本篇文章主要解决的是,MySQL事务创建之后,没有运行的问题] 首先从这里开始:http://www.w3schools.in/mysql/event-schedule/,创建了基本的MySQL事务 ...
- Linux系统消息队列框架Kafka单机安装配置
http://www.ithao123.cn/content-11128587.html
- HTML5学习笔记之二CSS基础
一般来说,CSS都存储为一个文件.然后各个html page能够指定使用哪个CSS文件.这样这些html页面就能够保持一致的风格. 通常能够通过在head中加上一行指定CSS的链接. <!DOC ...
- 11.Axis客户端接收不同参数类型
转自:http://www.guance.com/708.html axis只支持简单类型的返回值.在这里逐一介绍axis的各种返回值接受. 1. axis接受基本类型,如int, string等 引 ...
- 4.Maven之(四)Maven命令
转自:https://blog.csdn.net/u012152619/article/details/51473410
- js---对象 和 函数this
一:对象创建的方法 //普通 字面量形式 var obj = { name:'名字', fn:function(){ console.log(this.name); } } //new 实例 var ...