[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. ...
随机推荐
- vim 脚本之快捷注释
今天初步学习了下vim的脚本知识,并尝试写了一个简单的脚本.当然,这个脚本很简单,使用的方法也很笨拙.不过,这仅仅是一个开始,等以后随着对vim语法的深入了解,会不断优化这个脚本的.先记录下来 &qu ...
- android CoordinatorLayout使用
一.CoordinatorLayout有什么作用 CoordinatorLayout作为“super-powered FrameLayout”基本实现两个功能: 1.作为顶层布局 2.调度协调子布局 ...
- dubbo+zookeeper+springMVC +maven
pom: <dependency> <groupId>com.github.sgroschupf</grou ...
- Postfix邮件系统安装配置视频
Postfix邮件系统安装配置视频(文字资料详见linux企业应用案例精解),全部视频分为四个部分,详情如下: http://115.com/file/be9j4dsj#postfix-1.rar h ...
- Python(三) 变量与运算符
一.什么是变量 变量 = [1,2] 二.变量的命名规则 字母,数字,下划线,首字母不能是数字 系统关键字 不能用在变量名中 保留关键字 区别大小写 a=1, a='1', a=(1,2), ...
- mescroll报错
1.Cannot read property 'insertBefore' of null:说明你的容器id未找到,应确认你的容器id名与你NEW的容器名一致:
- 【使用uWSGI和Nginx来设置Django和你的Web服务器】
目录 安装使用uWSGI 配置Nginx结合uWSGI supervisor Django静态文件与Nginx配置 @ *** 所谓WSGI . WSGI是Web服务器网关接口,它是一个规范,描述了W ...
- 修改mysql 的 字符集 解决中文乱码问题
确定的是自己mysql的字符集是否都是utf8, 通过mysql -u root -p然后输入数据库的密码登陆. 在mysql命令行查询自己的字符集是否都是utf8(除了文件的编码是binary). ...
- CCF模拟题 有趣的数
有趣的数 时间限制: 1.0s 内存限制: 256.0MB 问题描述 我们把一个数称为有趣的,当且仅当: 1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次. 2. 所有的0都 ...
- mybatis自己主动生成mapper,dao,映射文件
一.先创建数据脚本,这里用的mysql数据脚本 drop table VOTE_ITEM; drop table VOTE_OPTION; drop table VOTE_SUBJECT; drop ...