Skip to content
This repository was archived by the owner on Jul 31, 2026. It is now read-only.

feat: mark as tree-shakable - #311

Merged
danielkov merged 1 commit into
mainfrom
danielkov/mark-as-sideeffect-free
Oct 20, 2025
Merged

feat: mark as tree-shakable#311
danielkov merged 1 commit into
mainfrom
danielkov/mark-as-sideeffect-free

Conversation

@danielkov

Copy link
Copy Markdown
Contributor

What / Why?

  • Marks package as tree-shakable, instructing compilers that they can remove unused parts
  • The intended effect is to reduce bundle size for parts that are unused

Warning

This depends on the package being side-effect-free. Tested on speakeasy-registry.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread package.json
"version": "1.9.1",
"packageManager": "pnpm@9.0.0",
"description": "Speakeasy's design system Moonshine",
"sideEffects": false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: CSS Exports Require sideEffects: true

Setting sideEffects: false in package.json is incorrect for a package that exports CSS files. CSS imports have global side effects, so bundlers may incorrectly tree-shake them, potentially causing missing styles in production builds.

Fix in CursorFix in Web

@danielkov danielkov Oct 20, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was also concerned by this, but based on our usage and the README:

### 2. Configure Tailwind CSS

Add this to the top of your project's CSS file where you configure Tailwind:

```css
/* This must come BEFORE your Tailwind imports */
@reference "../node_modules/@speakeasy-api/moonshine/src/global.css";

We shouldn't depend on CSS-injection from JS.

Also possible to do "sideEffects": ["*.css"].

@danielkov
danielkov merged commit 42dcdab into main Oct 20, 2025
10 checks passed
@danielkov
danielkov deleted the danielkov/mark-as-sideeffect-free branch October 20, 2025 15:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants