@@ -49,7 +49,8 @@ include ../_util-fns
49
49
:marked
50
50
## Library package format
51
51
52
- In order to understand how to build and publish a library, you have to consider _how_ the library is going to be consumed.
52
+ In order to understand how to build and publish a library, you have to consider _how_ the library
53
+ is going to be consumed.
53
54
54
55
Some users need to add it as a `<script>` tag.
55
56
Others might prefer to use a module loader like [SystemJS](https://github.com/systemjs/systemjs)
@@ -65,19 +66,35 @@ include ../_util-fns
65
66
66
67
You can configure `package.json` with more entry points besides [main](https://docs.npmjs.com/files/package.json#main).
67
68
68
- The **Quickstart Library** seed uses a similar set of entry points as Angular itself,
69
- aimed at maximizing compatibility:
69
+ The recommended set of entry points is as follows:
70
70
71
71
- `main` (default): an ES5 [UMD](https://github.com/umdjs/umd) bundle that can be consumed anywhere.
72
72
- `module`: a flat ECMAScript module (FESM) bundle containing ES5 code.
73
73
- `es2015`: a FESM containing ES2015 bundle.
74
74
- `typings`: TypeScript and the AOT compiler will look at this entry for metadata.
75
75
76
- code-example( language ="json" ) .
77
- "main": "./dist/angular-quickstart-lib.umd.js",
78
- "module": "./dist/angular-quickstart-lib.es5.js",
79
- "es2015": "./dist/angular-quickstart-lib.js",
80
- "typings": "./dist/angular-quickstart-lib.d.ts",
76
+ A library should have the following file layout when published:
77
+
78
+ .filetree
79
+ .file node_modules/library-name
80
+ .children
81
+ .file dist
82
+ .children
83
+ .file library-subfolders/...
84
+ .file library-name.d.ts ('typings')
85
+ .file library-name.es5.js ('module')
86
+ .file library-name.js ('es2015')
87
+ .file library-name.metadata.json
88
+ .file library-name.umd.js ('main')
89
+ .file library-name.umd.min.js
90
+ .file index.d.ts
91
+ .file module.d.ts
92
+ .file LICENSE
93
+ .file package.json
94
+ .file README.md
95
+
96
+
97
+
81
98
82
99
:marked
83
100
There is also a minified UMD bundle (`angular-quickstart-lib.umd.min.js`) for smaller payloads
0 commit comments