Open zolakt opened 5 years ago
Revisited this after a while and found the problem. It's due to how tslib is imported, which doesn't work with the Closure compiler.
The lib needs to use tsickle when it builds (so it could just be a dev dependency) and add this to tsconfig.json, in order to be compatible:
"angularCompilerOptions": {
...
"annotateForClosureCompiler": true
}
For example (at least in newer versions) when you create a library project with angular cli, it will add tsickle dependency automatically.
All the source code if fine, it's just a build process issue. Adding those 2 lines (package.json and tsconfig.json) should make it compatible.
Thanks for the comment. Would you mind creating a PR for it?
Not sure what the problem is exactly. I can't see anything in the code that would break the closure compiler, so I suspect it is something related with how the output lib files are generated. Maybe someone more proficient with the closure compiler can pitch in with the details.
Tried importing if both from esm2015 and fesm2015 packages.
When using esm2015, I've added this to closure.config:
And this is the error I get:
When using fesm2015, I've added this to closure.config:
And this is the error I get:
The only way I can get it not to break is with the fesm2015 version, and I change the tslib config to this:
And change the the package_json_entry_names from:
to:
In that case it doesn't break, but produces a empty (0B) bundle.js file