Packaging Angular - Jason Aden
Why Stack Overflow recommends it
Stack Overflow users link it when answering how to bundle, publish and structure Angular 4 and TypeScript modules for npm.
Recommended by 2 people across 2 different months, 2017 to 2017.
What it is
A conference talk from ng-conf by Jason Aden on how to package and publish Angular libraries and components. It covers module configuration, bundling with tools like Rollup, and producing npm packages without piles of boilerplate.
What people said
Strong rec Konstantin Vitkovsky · 2017-08 · Stack Overflow · on “Angular 4 feature module”
Here is a very good talk [this video] on YouTube that will help you achieve that. It covers the configuration from scratch without tons of dependencies and boilerplate code.
Recommends Neil Lunn · 2017-05 · Stack Overflow · on “Using commonjs modules in Angular4 services?”
Naturally you can `import` any module ( any compatible at least ) and probably all you need is a "typescript shape" of the module exports for usage. How to import a js library without definition file in typescript file [LINK] is one of many sources of answers on this. Alternately since it is **your** library, then why not go all the way and and bundle it properly from the beginning. There was a recent talk at NgConf on this [this video]
Cites Ole · 2017-05 · Stack Overflow · on “Publishing Typescript 2.3 Modules to NPM for Angular 4 Consumption”
There are related instructions in Writing NPM modules in Typescript [LINK] , however it's dated and there are now a lot of different answers which may or may not work for Angular. There's also a very good presentation by Jason Aden on [this video] on how to publish Angular Components, but in this case I'm only interested in publishing vanilla typescript classes.
Cites Ole · 2017-06 · Stack Overflow · on “Publishing Typescript 2.3 Modules to NPM for Angular 4 Consumption”
I finished a prototype for testing this out. I used code from this article - creating npm modules written in typescript [LINK] and the rollup suggestion from Jason Aden's Packaging Angular Presentation [this video] . Note that the tsconfig-cjs.json part of this is there so that in addition to supporting webpack and Angular, we also support commonjs + es5 workflows. Github Repository TS Module Producer Project [LINK] Steps Project Setup Initialize the Project (The TS Module Producer) mkdir tsmproducer cd tsmproducer # Initialize the project's package.json npm init -y Replace package.json : { "name": "tsmproducer", "version": "1.0.0", "description": "Example typescript npm project supporting es6 mo