[英]How to create Angular2 npm package with angular-cli?
I would like create a npm package for a project. 我想为一个项目创建一个npm包。 I used angular-cli to create my components I would like package.
我使用angular-cli创建了我想要打包的组件。
My tsconfig.json 我的tsconfig.json
{
"compilerOptions": {
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
I can generate *.d.ts
with ng build
我可以用
ng build
生成*.d.ts
And then, with npm link
I can test my package into other project, but my module which contains my components is not found.. :/ 然后,通过
npm link
我可以将我的程序包测试到其他项目中,但是找不到包含我的组件的模块。
Have you some ideas ? 你有什么主意吗? :)
:)
Hi I think this documentation will help you. 嗨,我认为本文档将为您提供帮助。 I have successfully created npm package using yoman from my angular2 component.
我已经从我的angular2组件中使用yoman成功创建了npm包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.