Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Package exports #1168

Closed
wants to merge 6 commits into from
Closed

fix: Package exports #1168

wants to merge 6 commits into from

Conversation

benjackwhite
Copy link
Collaborator

Changes

Fixes #908

  • Need to somehow validate this actually solves the issue

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview May 22, 2024 8:05am

Copy link

github-actions bot commented May 8, 2024

Size Change: -262 kB (-23.7%) 🎉

Total Size: 844 kB

Filename Size Change
dist/array.full.js 234 kB +169 B (+0.07%)
dist/array.js 132 kB +169 B (+0.13%)
dist/es.js 0 B -132 kB (removed) 🏆
dist/module.js 0 B -132 kB (removed) 🏆
dist/surveys-module-previews.js 57.7 kB +467 B (+0.82%)
dist/surveys.js 59.3 kB +467 B (+0.79%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 12.2 kB
dist/recorder-v2.js 108 kB
dist/recorder.js 108 kB
dist/umd/index.js 132 kB

compressed-size-action

@posthog-bot
Copy link
Collaborator

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@AlexGodard
Copy link

Posting to keep it open -- I need this

@pauldambra
Copy link
Member

trying to use this in my normal flow locally in posthog-js

I get

[ESBUILD] ✘ [ERROR] Could not resolve "posthog-js/dist/surveys-module-previews"
[ESBUILD] 
[ESBUILD]     frontend/src/scenes/surveys/SurveyAppearancePreview.tsx:1:66:
[ESBUILD]       1 │ ...nderSurveysPreview } from 'posthog-js/dist/surveys-module-previews'
[ESBUILD]         ╵                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ESBUILD] 
[ESBUILD]   The path "./dist/surveys-module-previews" is not exported by package "posthog-js":
[ESBUILD] 
[ESBUILD]     node_modules/posthog-js/package.json:28:15:
[ESBUILD]       28 │     "exports": {
[ESBUILD]          ╵                ^
[ESBUILD] 
[ESBUILD]   You can mark the path "posthog-js/dist/surveys-module-previews" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

and

[ESBUILD] Error: ENOENT: no such file or directory, stat '/Users/paul/github/posthog/frontend/dist/index.css'
[ESBUILD] Error: ENOENT: no such file or directory, stat '/Users/paul/github/posthog/frontend/dist/index.js'
[TYPEGEN] 💔 frontend/src/index.tsx:5:33 - error TS2307: Cannot find module 'posthog-js/react' or its corresponding type declarations.
[TYPEGEN] 
[TYPEGEN] 5 import { PostHogProvider } from 'posthog-js/react'
[TYPEGEN]                                   ~~~~~~~~~~~~~~~~~~
[TYPEGEN] 
[TYPEGEN] 💔 frontend/src/scenes/feature-flags/FeatureFlag.tsx:29:32 - error TS2307: Cannot find module 'posthog-js/react' or its corresponding type declarations.

multiple instances of

[TYPEGEN] 💔 frontend/src/toolbar/flags/flagsToolbarLogicType.ts:256:18 - error TS2304: Cannot find name 'PostHog'.
[TYPEGEN] 
[TYPEGEN] 256         posthog: PostHog | null

@posthog-bot
Copy link
Collaborator

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Collaborator

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@posthog-bot posthog-bot closed this Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing pkg.exports in package.json
4 participants