posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Bug report: Issue with rrweb dependency when compiled for typescript app

Open jondrummond-codeo opened this issue 1 year ago • 7 comments
trafficstars

We get the following error when trying to compile our typescript app using posthog-js.

image

Seems to have been introduced with v1.164.0

jondrummond-codeo avatar Sep 25 '24 11:09 jondrummond-codeo

I have the same error.

SUM-Soft avatar Sep 26 '24 16:09 SUM-Soft

Same issue with version 1.165.0.

medfx avatar Sep 28 '24 15:09 medfx

any update on this issue, its present on 1.167.0 as well

Predhin avatar Oct 10 '24 09:10 Predhin

This issue starts for me in 1.164.0 - so it was probably this https://github.com/PostHog/posthog-js/pull/1413

seeplusplus avatar Oct 10 '24 17:10 seeplusplus

+1 https://posthoghelp.zendesk.com/agent/tickets/19196

slshults avatar Oct 10 '24 21:10 slshults

+1 https://posthoghelp.zendesk.com/agent/tickets/19425

abigailbramble avatar Oct 16 '24 10:10 abigailbramble

version 1.174.2

Error: node_modules/posthog-js/dist/module.d.ts:1:50 - error TS2307: Cannot find module 'rrweb-snapshot' or its corresponding type declarations.

1 import { MaskInputOptions, SlimDOMOptions } from 'rrweb-snapshot';
                                                   ~~~~~~~~~~~~~~~~


Error: node_modules/posthog-js/dist/module.d.ts:2:31 - error TS2307: Cannot find module '@rrweb/types' or its corresponding type declarations.

2 import { eventWithTime } from '@rrweb/types';
                                ~~~~~~~~~~~~~~

SUM-Soft avatar Oct 20 '24 12:10 SUM-Soft

Are there any updates or workarounds for this issue? The build still breaks with Posthog 1.190.2?

Error: node_modules/posthog-js/dist/module.d.ts:1:24 - error TS2307: Cannot find module '@rrweb/record' or its corresponding type declarations.

1 import { record } from '@rrweb/record';

Error: node_modules/posthog-js/dist/module.d.ts:2:31 - error TS2307: Cannot find module '@rrweb/types' or its corresponding type declarations.

2 import { eventWithTime } from '@rrweb/types';

iirorahkonen avatar Nov 27 '24 12:11 iirorahkonen

@PostHog Any progress on this issue? The build is still breaks with 1.200.1

SUM-Soft avatar Dec 15 '24 10:12 SUM-Soft

still broken in 1.203.1. import { record } from '@rrweb/record'; record is now not separated it's inside rrweb?

codezaur avatar Dec 22 '24 08:12 codezaur

can folk share what version of node and TS they're using?

we're importing posthog-js in a CI test to validate minimum supported TS version and don't get this error, so, since I can't repro it i can't suggest a fix 😅

pauldambra avatar Dec 26 '24 14:12 pauldambra

can folk share what version of node and TS they're using?

node -v v18.16.1 [email protected]

I personally downgraded to posthog-js: 1.181.0, as was suggested in other thread, and it works now.

codezaur avatar Dec 27 '24 00:12 codezaur

can folk share what version of node and TS they're using?

Node v22.12.0 typescript: 5.5.4

My build breaks with every Posthog version greater than 1.163.0

image

SUM-Soft avatar Dec 27 '24 18:12 SUM-Soft

Setting "skipLibCheck": true in compilerOptions section of TSConfig solve the compile error for me.

SUM-Soft avatar Jan 02 '25 18:01 SUM-Soft

+1 https://posthoghelp.zendesk.com/agent/tickets/22888

HaynesPostHog avatar Jan 09 '25 20:01 HaynesPostHog

in the short term if you set skipLibCheck to true then this works for you you can see in our CI in this repo that this TS compiles

i appreciate not everybody wants to set that

pauldambra avatar Feb 03 '25 14:02 pauldambra

I'm currently still getting this issue as well

Pinois avatar May 14 '25 09:05 Pinois

So many issues and comments about this for 10 months now and it's still not fixed. It's a pity, but I have little choice but to move on. You might wanna consider removing TS based frameworks from your "install" page - it's annoying to have wasted time on this.

daverickdunn avatar Jun 04 '25 16:06 daverickdunn

I ran into this issue today.

hamirmahal avatar Sep 23 '25 18:09 hamirmahal

Guys, we are still stuck at 1.161.6

You are a very likeable company with a great product and philosophy. I can't understand why the responsible team is just ignoring this problem.

I really love PostHog, but if we can't stay up to date, we should and we will find another analytics service :(

medfx avatar Oct 04 '25 22:10 medfx