0
我想爲一個項目創建一個npm包。我用angular-cli來創建我想要打包的組件。如何使用angular-cli創建Angular2 npm包?
我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"
]
}
}
我可以生成*.d.ts
與ng build
,然後用npm link
我可以測試我的包裹到其他項目,但我的模塊,其中包含我的組件是找不到的。 。:/
你有什麼想法嗎? :)
你的問題不太清楚你的問題是什麼 - 你是說你建立你的應用程序,它不工作?因爲這可能與此有關:http://stackoverflow.com/questions/37558656/angular-clis-ng-build-doesnt-produce-a-working-project – Zze
我不能生成我的項目,以便使用它在另一個項目作爲npm的依賴關係 –
目前,您無法通過CLI執行此操作。按照這個線程,你可以在這裏找到很多有趣的東西:https://github.com/angular/angular-cli/issues/1692#issuecomment-273989471 – DDRamone