0

I am learning how angular (4+) compile project AOT to create a library and I some questions about the files generated. I wrote a script in order to create esm and umd bundle (.js and .map.js), metadata and types for each file (ngc) and the package.json (where I defined entry points for bundle)

{
  "main": "maestro.umd.js",
  "jsnext:main": "maestro.esm.js",
  "module": "maestro.esm.js",
  "types": "index.d.ts"
}

However, even if JIT compilation worked correctly when I integrated my bundle in the main project, I had an issue with AOT one. In order to resolve it, I had to copy every .js files generated by ngc inside the dist folder. So, to resume I deliver these files for my library:

  • package.json
  • esm bundle (.js and .map.js)
  • umd bundle (.js and .map.js)
  • ngc generated files (.d.ts, .metadata.json and .js for each .ts file)

Could someone please confirm me that we need .js files? Could it be possible to use umd bundle during AOT compilation instead?

Andrea11
  • 13
  • 3
  • please add the code that is causing the fail and add screenshots too – Aravind Dec 28 '17 at 09:48
  • sure, I will add it. But my question it is more theoretical than practical. I would like to know the best practices to build your library in angular, and especially which files you have to provide – Andrea11 Dec 28 '17 at 13:01
  • This can be achieved using gulp automated tasks. Please reply back if you need more help – Aravind Dec 28 '17 at 18:24
  • Ok, but which files should I provide in order to publish my library? And should I publish js files? (one per .ts file) – Andrea11 Dec 29 '17 at 13:53

0 Answers0