0

I would like create a npm package for a project. I used angular-cli to create my components I would like package.

My 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

And then, with npm link I can test my package into other project, but my module which contains my components is not found.. :/

Have you some ideas ? :)

4
  • Your question is not really clear as to what your issue is - are you saying that you build out your app and it doesn't work? Because that could be related to this: stackoverflow.com/questions/37558656/… Commented Jan 25, 2017 at 21:54
  • I can not generate my project in order to use it in another project as a dependency with npm Commented Jan 25, 2017 at 21:58
  • 1
    Currently you're not able to do it via CLI. Follow this thread, you can find a lot of interesting stuff here: github.com/angular/angular-cli/issues/… Commented Jan 25, 2017 at 22:13
  • There is a post and sample code here showing how to isolate a module in an Angular-cli project and publish it as an npm package which might be helpful. Commented Aug 20, 2017 at 5:37

1 Answer 1

4

Hi I think this documentation will help you. I have successfully created npm package using yoman from my angular2 component.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.