Package Exports
- ng-packagr/lib/util/log
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-packagr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ng-packagr
Compile and package a TypeScript library to Angular Package Format
Usage Example
Create a configuration file .ng-packagr.json
:
{
"src": "my-lib-source-folder",
"dest": "dist/my-lib",
"workingDirectory": ".ng_build",
"ngc": {
"tsconfig": "tsconfig.lib.json"
}
}
The tsconfig
file is located relative to the src
folder, e.g. in `my-lib-source-folder/tsconfig.lib.json´.
It must follow this conventions:
- In
"angularCompilerOptions"
:- use
flatModuleId
andflatModuleOutFile
- set
"strictMetadataEmit": true
and"skipTemplateCodegen": true
- use
- Has one single entry file to the library in
"files": []
- it's recommended to name it
src/public_api.ts
and set in combination with"flatModuleOutFile": "index"
(see above)
- it's recommended to name it
- In
"compilerOptions"
:- must transpile to a real ES2015 bundle with
"target": "es2015"
and"module": "es2015"
(transformations to ES5 and legacy bundle formats are performed by the tool later)
- must transpile to a real ES2015 bundle with
{
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"flatModuleId": "@foo/bar",
"flatModuleOutFile": "index",
"skipTemplateCodegen": true,
"strictMetadataEmit": true
},
"buildOnSave": false,
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"outDir": "src",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"skipLibCheck": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"dom",
"es2015"
]
},
"exclude": [
"node_modules",
"dist",
"**/*.ngfactory.ts",
"**/*.shim.ts",
"**/*.spec.ts"
],
"files": [
"src/public_api.ts"
]
}
Knowledge
Packaging Angular - Jason Aden at ng-conf 2017