ivy-ngcc doesn't transform UMD bundles correctly
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by ivy-ngcc toolIs this a regression?
no
Description
ivy-ngcc transforms UMD bundles incorrectly. In particular, the symbol Injectable
ends up as undefined in the transformed UMD bundle.
AriaDescriber.decorators = [
{ type: core.Injectable, args: [{ providedIn: 'root' },] },
];
/** @nocollapse */
AriaDescriber.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
]; };
/** @nocollapse */ AriaDescriber.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function AriaDescriber_Factory() { return new AriaDescriber(core.ɵɵinject(common.DOCUMENT)); }, token: AriaDescriber, providedIn: "root" });
return AriaDescriber;
in node_modules/@angular/cdk/bundles/cdk-a11y.umd.js.__ivy_ngcc_bak
gets transformed to
/*@__PURE__*/ ɵngcc0.ɵsetClassMetadata(AriaDescriber, [{
type: Injectable,
args: [{ providedIn: 'root' }]
}], function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [common.DOCUMENT]
}] }]; }, { _document: [], describe: [], removeDescription: [], ngOnDestroy: [], _createMessageElement: [], _deleteMessageElement: [], _createMessagesContainer: [], _deleteMessagesContainer: [], _removeCdkDescribedByReferenceIds: [], _addMessageReference: [], _removeMessageReference: [], _isElementDescribedByMessage: [], _canBeDescribed: [], _isElementNode: [] });
return AriaDescriber;
in node_modules/@angular/cdk/bundles/cdk-a11y.umd.js
where type: Injectable,
is undefined when run in the browser:
Uncaught ReferenceError: Injectable is not defined
I would guess it should be type: core.Injectable
since core
is the @angular/core
UMD dependency.
@angular/cdk/bundles/cdk-a11y.umd.js
is just an example but same thing happens in other bundles transformed.
🔬 Reproduction
Clone the wassim/ivy
branch of my fork of angular-bazel-example (https://github.com/gregmagolan/angular-bazel-example/tree/wassim/ivy) and run yarn install
. ivy-ngcc
is run in the postinstall
step and you can inspect the resulting transofmed bundles under node_modules.
🔥 Exception or Error
🌍 Your Environment
Angular Version:
Anything else relevant?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top GitHub Comments
I’ll take a look.
Confirmed that all the UMD bundles used by angular-bazel-example (including @ngrx which was using
core.Injectable()
) are correctly transformed now with ivy-ngcc from angular 9.0.0-next.2. Tested in https://github.com/angular/angular-bazel-example/pull/505. Thanks @petebacondarwin @JoostK!@alexeagle @CaerusKaru ^^