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

fix: check if window is available before using on web env

Open marandaneto opened this issue 1 year ago • 1 comments

Problem

Closes https://github.com/PostHog/posthog-js-lite/issues/255 Similar to https://github.com/PostHog/posthog-js-lite/pull/57

Changes

Release info Sub-libraries affected

Bump level

  • [ ] Major
  • [ ] Minor
  • [ ] Patch

Libraries affected

  • [ ] All of them
  • [ ] posthog-web
  • [ ] posthog-node
  • [ ] posthog-react-native

Changelog notes

  • Added support for X

marandaneto avatar Sep 10 '24 08:09 marandaneto

Size Change: +463 B (+0.43%)

Total Size: 109 kB

Filename Size Change
posthog-node/lib/index.cjs.js 20.8 kB +5 B (+0.02%)
posthog-node/lib/index.esm.js 20.7 kB +5 B (+0.02%)
posthog-react-native/lib/posthog-core/src/utils.js 870 B +48 B (+5.84%) 🔍
posthog-web/lib/index.cjs.js 17.8 kB +203 B (+1.15%)
posthog-web/lib/index.esm.js 17.8 kB +202 B (+1.15%)
ℹ️ View Unchanged
Filename Size
posthog-react-native/lib/posthog-core/src/eventemitter.js 1.08 kB
posthog-react-native/lib/posthog-core/src/index.js 10 kB
posthog-react-native/lib/posthog-core/src/lz-string.js 1.42 kB
posthog-react-native/lib/posthog-core/src/types.js 420 B
posthog-react-native/lib/posthog-core/src/vendor/uuidv7.js 2.04 kB
posthog-react-native/lib/posthog-react-native/index.js 485 B
posthog-react-native/lib/posthog-react-native/src/autocapture.js 1.8 kB
posthog-react-native/lib/posthog-react-native/src/frameworks/wix-navigation.js 651 B
posthog-react-native/lib/posthog-react-native/src/hooks/useFeatureFlag.js 437 B
posthog-react-native/lib/posthog-react-native/src/hooks/useFeatureFlags.js 362 B
posthog-react-native/lib/posthog-react-native/src/hooks/useLifecycleTracker.js 416 B
posthog-react-native/lib/posthog-react-native/src/hooks/useNavigationTracker.js 628 B
posthog-react-native/lib/posthog-react-native/src/hooks/usePostHog.js 249 B
posthog-react-native/lib/posthog-react-native/src/legacy.js 810 B
posthog-react-native/lib/posthog-react-native/src/native-deps.js 1.2 kB
posthog-react-native/lib/posthog-react-native/src/optional/OptionalAsyncStorage.js 183 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalExpoApplication.js 215 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalExpoDevice.js 211 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalExpoFileSystem.js 224 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalExpoLocalization.js 216 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalReactNativeDeviceInfo.js 220 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalReactNativeNavigation.js 218 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalReactNativeNavigationWix.js 222 B
posthog-react-native/lib/posthog-react-native/src/optional/OptionalSessionReplay.js 231 B
posthog-react-native/lib/posthog-react-native/src/posthog-rn.js 4.42 kB
posthog-react-native/lib/posthog-react-native/src/PostHogContext.js 210 B
posthog-react-native/lib/posthog-react-native/src/PostHogProvider.js 1.57 kB
posthog-react-native/lib/posthog-react-native/src/storage.js 1.09 kB
posthog-react-native/lib/posthog-react-native/src/types.js 90 B
posthog-react-native/lib/posthog-react-native/src/version.js 123 B

compressed-size-action

github-actions[bot] avatar Sep 10 '24 08:09 github-actions[bot]

Screenshot 2025-01-17 at 11 01 48

works for web and node, assuming this will work for the web workers too since all I've done is to add extra checks for the window and fetch objects. totally forgot about this issue btw, I was skimming thru the repo and noticed the open PR, well now it's done.

marandaneto avatar Jan 17 '25 10:01 marandaneto