Amplitude-JavaScript icon indicating copy to clipboard operation
Amplitude-JavaScript copied to clipboard

Export "getInstance" was not found in "amplitude-js"

Open bureaug opened this issue 10 months ago • 1 comments

Summary

I have been using amplitude with Angular up to V11 with no problems. After upgrading to Angular 15.2.9 and trying to compile the project I get the following error:

./libs/***/analytics.service.ts:6:22-43 - Error: export 'getInstance' (imported as 'amplitude') was not found in 'amplitude-js' (possible exports: default)

./libs/***/analytics.service.ts:40:25-43 - Error: export 'Identify' (imported as 'amplitude') was not found in 'amplitude-js' (possible exports: default)

The analytics.service.ts looks like this:

import { Injectable } from '@angular/core';
import * as amplitude from 'amplitude-js';

@Injectable()
export class AnalyticsService {

	private amInstance = amplitude.getInstance();
        [...]

Here is an excerpt from my package.json


	"dependencies": {
		"@angular/animations": "15.2.9",
		"@angular/cdk": "15.2.9",
		"@angular/common": "15.2.9",
		"@angular/compiler": "15.2.9",
		"@angular/core": "15.2.9",
		"@angular/forms": "15.2.9",
		"@angular/platform-browser": "15.2.9",
		"@angular/platform-browser-dynamic": "15.2.9",
		"@angular/router": "15.2.9",
		"amplitude-js": "^8.21.9",
		"reflect-metadata": "^0.1.10",
		"rxjs": "~6.6.3",
		"tslib": "^2.0.0",
		"zone.js": "0.12.0"
	},

Thanks for any tips!

bureaug avatar Sep 15 '23 13:09 bureaug