Skip to content

fix: exclude atoms web wrappers from build#15216

Merged
ThyMinimalDev merged 5 commits intomainfrom
exclude-web-wrappers-from-atoms
May 28, 2024
Merged

fix: exclude atoms web wrappers from build#15216
ThyMinimalDev merged 5 commits intomainfrom
exclude-web-wrappers-from-atoms

Conversation

@supalarry
Copy link
Copy Markdown
Contributor

@supalarry supalarry commented May 28, 2024

Problem

Platform customer (coho) reported that when wrapping their React app built using vite with CalProvider the app crashes because somehow process.env.__NEXT_ROUTER_BASEPATH is expected.

screen-capture.5.webm

Solution

I confirmed with the customer that they are importing atoms from import { CalProvider } from "@calcom/atoms"; and not from import { CalProvider } from "@calcom/atoms/monorepo";, so my only explanation is that when importing from the atoms package somehow code related to Web wrappers is touched - Web wrappers like "WebAvailabilitySettingsWrapper" have next router imports "import { useRouter } from "next/navigation";".

And the thins is that Web wrappers are included into the dist folder and published as atoms also increasing the package size.

So I

  1. Adjusted tsconfig.json to exclude all files ending with "WebWrapper.tsx".
  2. Renamed all web wrappers to follow schema "Component(Web|Platform)Wrapper.tsx" so that they can be matched by regex in step 1. See commit refactor: wrappers follow schema Component(Web|Platform)Wrapper.tsx.

Atoms build: Before

Screenshot 2024-05-28 at 10 57 10

Atoms build: After

Screenshot 2024-05-28 at 11 07 58

Final notes

Even if this does not solve customer issue it will reduce package size. I tested examples app and cal web app locally and availability settings and booker work.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels May 28, 2024
@graphite-app graphite-app Bot requested a review from a team May 28, 2024 08:17
@dosubot dosubot Bot added the 🐛 bug Something isn't working label May 28, 2024
@supalarry supalarry marked this pull request as draft May 28, 2024 08:18
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 28, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (05/28/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add platform team as reviewer" took an action on this PR • (05/28/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2024

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

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview May 28, 2024 9:18am
cal ⬜️ Ignored (Inspect) Visit Preview May 28, 2024 9:18am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 28, 2024 9:18am

@supalarry supalarry marked this pull request as ready for review May 28, 2024 09:18
@ThyMinimalDev ThyMinimalDev added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 655127d May 28, 2024
@ThyMinimalDev ThyMinimalDev deleted the exclude-web-wrappers-from-atoms branch May 28, 2024 10:25
p6l-richard pushed a commit to p6l-richard/cal.com-fork that referenced this pull request Jul 22, 2024
* fix: exclude atoms web wrappers from build

* refactor: tsconfig web wrapper regex

* refactor: wrappers follow schema Component(Web|Platform)Wrapper.tsx

* fix: tsconfig regex for web wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working core area: core, team members only platform Anything related to our platform plan 💻 refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants