robisim74 / angular-library-starter

Build an Angular library compatible with AoT compilation and Tree shaking like an official package
MIT License
269 stars 58 forks source link

Questions: Debugging typescript & using this without angular #35

Closed Nasicus closed 6 years ago

Nasicus commented 6 years ago

Hi

I have two questions:

Debug Typesript

It's important for me that you can debug the typescript sources when you use "my" npm package.

I cloned this repo, executed npm run build and npm run pack:lib. Then I used the angular quickstart-project (https://angular.io/generated/zips/cli-quickstart/cli-quickstart.zip) and in there ran npm install my-library.tgz. This all worked perfectly. I then used the the SumService and the app component and ran npm start. Still everything's working just fine. Then I debugged the code of my app component (in chrome) and went "into" the SumService. Now instead of using the ts file the debugger went into the js file (webpack:///...cli-quickstartTEST/node_modules/angular-library-starter/esm5/angular-library-starter.js) even though the .js.map file is right there next to the other file. What could be the problem here? Is there a misconfiguration? Or do you need to configure anything special?

Not Angular packages

This is maybe a little strange: But do you think this repo is a good starting point for non-angular packages? This project here just seems as a very clean and good starting point, that's why I'm thinking of using it :) If yes: Are there any particular points which are important / must be considered? If no: Do you know any other good sample project without angular? ;)

Thanks in advance

robisim74 commented 6 years ago

Hi @Nasicus,

about the debugging, it seems an Angular CLI issue: https://github.com/angular/angular-cli/issues/5477 or can you see the .ts files of the Angular packages?

Regarding your second request: you can adapt it to a non-Angular library: just replace the compiler, and the related compilation options.

Nasicus commented 6 years ago

Hey @robisim74

Thanks for the quick answer. Well I can debug the app.ts (it's where I put my debuggerstatement). Didn't test further. But if you say that it normally works that's enough for me, since I won't have an angular app anyway :)