aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
117 stars 65 forks source link

bug: Cannot find module 'aws-rum-web' or its corresponding type declarations. #371

Closed Naes0 closed 1 year ago

Naes0 commented 1 year ago

Hi, I'm getting the following error when importing AwsRum and AwsRumConfig on v1.13.2:

Type error: Cannot find module 'aws-rum-web' or its corresponding type declarations.

Workaround has been to downgrade to v1.12.0. Very weird because I can see them being exported in the index.d.ts in node_modules. :/

Anyone else have this problem?

targumon commented 1 year ago

Yes, seeing this too. Maybe related to #363? ("fix: Transpile @aws-sdk to ES5.")

ivanpepelko commented 1 year ago

Additionally: this happens when trying to bump aws-rum-web from 1.12.0 to 1.13.2 For context, we have a vue app which depends on aws rum (vue3, esm, webpack).

with 1.13.2 a workaround is this:

import { AwsRum } from 'aws-rum-web/dist/es/src';

... which is something I don't want to do. It seems import root is missing index file.

qhanam commented 1 year ago

Thanks for raising this! We've deprecated v1.13.2 in NPM, and are working on a patch.

qhanam commented 1 year ago

Patched v1.13.3 is available on NPM.

Naes0 commented 1 year ago

Thanks @qhanam unfortunately I just tried v1.13.3, got the following error:

TypeError: Cannot read properties of undefined (reading 'version') at Object. (/app/node_modules/aws-rum-web/dist/cjs/src/event-cache/EventCache.js:19:47)

looks like it trying to access a 'default' property here which causes it to fail: var webClientVersion = version_json_1.default.version;

qhanam commented 1 year ago

@Naes0 what build system and module (i.e., es/cjs) are you using?

Naes0 commented 1 year ago

@qhanam We're using Next.js 13 (not turbopack) so webpack 5 and cjs on the server and esm in the browser :)