-
Notifications
You must be signed in to change notification settings - Fork 22
Description
To provide an easy to use, productive and dev friendly seed here are some suggested refactoring.
Each suggestion has an issue attached, this issue is used for managing the issues:
-
Move to Webpack 2 (Move to Webpack 2 #6)
-
Add DEMO application (Add demo application parallel to lib #9)
-
Support AoT friendly package (Support AoT compilation #8)
-
Output a UMD bundle (Output UMD bundle #7)
Distributed package structure
The end result of the package should contain 2 versions of the package
- ES5 bundle, 1 file, UMD format
- ES6 bundle, modular. (ESM)
The ES5 version will be used when importing the package, this is done by setting
"main": "path-to-es5-bundle.js`
in package.json
The ES6 version is a modular option that a developer need to opt-in to use, however it also plays a part in the ES5 UMD bundle.
When developing, user will usually:
import { Something } from 'my-lib'
The UMD bundle is used, it has no type information but the ES6 version does. The ES6 version comes with d.ts
files and they are referenced inside package.json
"typings": "esm/index.d.ts",
The ES6 version also hold *.metadata.json
files so it provides support for AoT compilation.
Since main
property references the UMD bundle we use the module
property to make sure ES6 module syntax code get the modular ES6 version and not the UMD bundle (so AoT can work)