angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

ESM5 compile error for Angular 9 (Ivy): expected MapsAPILoader to have an inner class declaration

Open l3ender opened this issue 5 years ago • 6 comments

Issue description I am seeing the following compilation error after updating to Angular v9 along with latest @agm/core version:

Compiling @agm/core : module as esm5
Error: Error on worker #1: Error: getInternalNameOfClass() called on a non-ES5 class: expected MapsAPILoader to have an inner class declaration
    at Esm5ReflectionHost.getInternalNameOfClass (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/host/esm5_host.js:88:23)
    at DelegatingReflectionHost.getInternalNameOfClass (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/host/delegating_host.js:89:34)
    at extractInjectableMetadata (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:125:69)
    at InjectableDecoratorHandler.analyze (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:66:24)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:345:40)
    at analyze (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:297:58)
    at _loop_1 (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:319:21)
    at NgccTraitCompiler.TraitCompiler.analyzeClass (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:325:35)
    at NgccTraitCompiler.analyzeFile (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:47:26)
    at DecorationAnalyzer.analyzeProgram (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:134:39)
    at ClusterMaster.onWorkerMessage (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:194:27)
    at /Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:54:95
    at ClusterMaster.<anonymous> (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:292:57)
    at step (/Users/l3ender/repos/my-app/node_modules/tslib/tslib.js:141:27)
    at Object.next (/Users/l3ender/repos/my-app/node_modules/tslib/tslib.js:122:57)
    at /Users/l3ender/repos/my-app/node_modules/tslib/tslib.js:115:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/l3ender/repos/my-app/node_modules/tslib/tslib.js:111:16)
    at EventEmitter.<anonymous> (/Users/l3ender/repos/my-app/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:286:32)
    at EventEmitter.emit (events.js:314:20)

Steps to reproduce and a minimal demo of the problem Here my dependencies:

"dependencies": {
	"@agm/core": "^3.0.0-beta.0",
	"@angular/animations": "^9.1.13",
	"@angular/cdk": "^9.2.4",
	"@angular/common": "^9.1.13",
	"@angular/compiler": "^9.1.13",
	"@angular/core": "^9.1.13",
	...
},
"devDependencies": {
	"@angular-devkit/build-angular": "~0.901.15",
	"@angular-devkit/build-ng-packagr": "~0.901.15",
	"@angular/cli": "^9.1.15",
	"@angular/compiler-cli": "^9.1.13",
	"@angular/language-service": "^9.1.13",
	"@nrwl/jest": "^12.0.7",
	"@types/googlemaps": "^3.43.3",
	...
}

The error occurs both with and without --prod build flag.

Current behavior Compilation fails.

Expected/desired behavior Compilation should succeed.

Other information We previously were using Angular 8 with "@agm/core": "^1.1.0", but were receiving warnings like the following:

npm WARN @agm/[email protected] requires a peer of @angular/common@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @agm/[email protected] requires a peer of @angular/core@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.

After upgrading to the latest @agm/core (3.0.0-beta.0) we are seeing the compilation issue.

l3ender avatar Apr 18 '21 23:04 l3ender

@SebastianM - any suggestions?

l3ender avatar May 31 '21 17:05 l3ender

@l3ender did you find a solution for this problem?

LereveLabs avatar Jul 19 '21 20:07 LereveLabs

@LereveLabs, no we are still using Angular 8.

l3ender avatar Jul 22 '21 18:07 l3ender

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 09 '22 03:01 stale[bot]

en el archivo tsConfig cambia el valor de target a es2015 en vez de esm5

eliezerFuentes16 avatar Jan 15 '22 02:01 eliezerFuentes16

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 06:04 stale[bot]