Skip to content

fix(shared): Remove "sideEffects" and fix postbuild script - #1974

Merged
LekoArts merged 6 commits into
mainfrom
fix/bundle-shared-in-expo
Oct 31, 2023
Merged

fix(shared): Remove "sideEffects" and fix postbuild script#1974
LekoArts merged 6 commits into
mainfrom
fix/bundle-shared-in-expo

Conversation

@LekoArts

@LekoArtsLekoArts commented Oct 30, 2023

Copy link
Copy Markdown
Contributor

Description

In the first commit I tried to bundle @clerk/shared into Expo but that didn't completely work as we'd also need to bundle React or Clerk JS -- ugh :/

So this PR adds the files and adjusts the subpaths script.

I also removed the sideEffects: false since tsup/esbuild complained that this package is not side-effects free. Which is true since some packages import shared chunks.

This is a follow-up to #1950

Fixes SDK-884

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

@changeset-bot

changeset-botBot commented Oct 30, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 26d72e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
NameType
@clerk/sharedPatch
@clerk/backendPatch
@clerk/clerk-jsPatch
@clerk/clerk-expoPatch
@clerk/fastifyPatch
@clerk/nextjsPatch
@clerk/clerk-reactPatch
@clerk/remixPatch
@clerk/clerk-sdk-nodePatch
gatsby-plugin-clerkPatch
@clerk/chrome-extensionPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@LekoArts

Copy link
Copy Markdown
ContributorAuthor

!snapshot

@clerk-cookie

This comment was marked as outdated.

@LekoArtsLekoArts changed the title fix(clerk-expo,shared): Bundle shared in expofix(shared): Remove "sideEffects" and fix postbuild scriptOct 30, 2023
Comment on lines +7 to +25
"browser",
"callWithRetry",
"color",
"cookie",
"date",
"deprecated",
"error",
"file",
"globs",
"handleValueOrFn",
"isomorphicAtob",
"keys",
"loadScript",
"localStorageBroadcastChannel",
"poller",
"proxy",
"underscore",
"url",
"react"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LekoArts why are these added at top level ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panteliselef Please see #1950

tmilewski
tmilewski previously requested changes Oct 30, 2023

@tmilewskitmilewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ I was wondering the same thing as @panteliselef. Are we able to nest them?

We'll need to define these additional directories in two places and a nested approach will make it more manageable.

  • NPM Script: clean will need to account for these generated files.
  • Turborepo: The generated files/dirs will also need to be listed in the build task outputs.

As-is, they both only account for ./dist.

Thanks!

@LekoArts

Copy link
Copy Markdown
ContributorAuthor

This is a follow-up to #1950 so the functionality is not new and Turborepo does not need to be considered here as these are only package.json files for compat reasons

@nikosdouvlis

Copy link
Copy Markdown
Member

❓ I was wondering the same thing as @panteliselef. Are we able to nest them?

We'll need to define these additional directories in two places and a nested approach will make it more manageable.

  • NPM Script: clean will need to account for these generated files.
  • Turborepo: The generated files/dirs will also need to be listed in the build task outputs.

As-is, they both only account for ./dist.

Thanks!

We're not able to nest them as we've found that Expo does not respect the exports field. Please see #1950 for more details.

"name": "@clerk/shared",
"version": "1.0.0",
"description": "Internal package utils used by the Clerk SDKs",
"sideEffects": false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you notice any side-effects (pun intended) in regards to code pruning when removing this?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still all worked fine during bundling :)

@LekoArts
LekoArts enabled auto-merge October 31, 2023 06:47
@LekoArts
LekoArts added this pull request to the merge queue Oct 31, 2023
Merged via the queue into main with commit a68eb30Oct 31, 2023
@LekoArts
LekoArts deleted the fix/bundle-shared-in-expo branch October 31, 2023 06:55
LekoArts added a commit that referenced this pull request Oct 31, 2023
* fix(clerk-expo,shared): Bundle shared in expo
* Revert "fix(clerk-expo,shared): Bundle shared in expo"
This reverts commit c1e0279.
* fix(shared): Add files key and fix script
* chore(repo): Linting
* fix(shared): Add package.json to exports
(cherry picked from commit a68eb30)
github-merge-queueBot pushed a commit that referenced this pull request Oct 31, 2023
…1983)
* fix(clerk-expo,shared): Bundle shared in expo
* Revert "fix(clerk-expo,shared): Bundle shared in expo"
This reverts commit c1e0279.
* fix(shared): Add files key and fix script
* chore(repo): Linting
* fix(shared): Add package.json to exports
(cherry picked from commit a68eb30)
Co-authored-by: Lennart <lekoarts@gmail.com>
@LekoArtsLekoArts mentioned this pull request Nov 3, 2023
24 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@LekoArts@clerk-cookie@nikosdouvlis@tmilewski@panteliselef