Skip to content

fix(visual-editing-standalone): type the styles.css export - #3630

Merged
stipsan merged 2 commits into
mainfrom
cursor/standalone-styles-css-types-3280
Aug 13, 2026
Merged

fix(visual-editing-standalone): type the styles.css export#3630
stipsan merged 2 commits into
mainfrom
cursor/standalone-styles-css-types-3280

Conversation

@stipsan

@stipsan stipsan commented Aug 13, 2026

Copy link
Copy Markdown
Member

Problem

Consumers such as nuxt-modules/sanity#1530 had to add:

declare module '@sanity/visual-editing-standalone/styles.css'

TypeScript 6 enables noUncheckedSideEffectImports by default (and @sanity/tsconfig/strictest turns it on), so import '@sanity/visual-editing-standalone/styles.css' fails unless the package ships types for that subpath.

Change

Publish ./styles.css as:

{
  "types": "./dist/styles.css.d.ts",
  "default": "./dist/styles.css"
}
  • types is a side-effect declaration (export {}), so consumers no longer need a local declare module.
  • default stays the stylesheet. A Node shim (exports.nodeCompat) would make esm.sh serve JS for <link rel="stylesheet" href="https://esm.sh/@sanity/visual-editing-standalone@2/styles.css"> — the same thing that happens today with @sanity/ui/styles.css.

The declaration is copied into dist after the Rolldown pass (and before publint). Emitting it from generateBundle is too early: the CSS asset is not in the bundle yet.

Test plan

  • Package tests (dist contract + typeof import('@sanity/visual-editing-standalone/styles.css'))
  • pnpm --filter @sanity/visual-editing-standalone build (publint clean)
  • Confirm the Nuxt module can drop declare module '@sanity/visual-editing-standalone/styles.css'
Open in Web Open in Cursor 

TypeScript 6 noUncheckedSideEffectImports requires declarations for
import '@sanity/visual-editing-standalone/styles.css', so Nuxt had to
declare the module locally. Ship a side-effect .d.ts behind a types
condition while keeping default on the stylesheet so esm.sh link tags
still resolve to text/css.

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
visual-editing-storybook Ready Ready Preview Aug 13, 2026 3:42pm
10 Skipped Deployments
Project Deployment Actions Updated (UTC)
visual-editing-astro Ignored Ignored Aug 13, 2026 3:42pm
visual-editing-next-with-i18n Ignored Ignored Aug 13, 2026 3:42pm
visual-editing-nuxt Ignored Ignored Aug 13, 2026 3:42pm
visual-editing-page-builder-vite Ignored Ignored Aug 13, 2026 3:42pm
visual-editing-remix Ignored Ignored Aug 13, 2026 3:42pm
visual-editing-svelte Ignored Ignored Aug 13, 2026 3:42pm
live-visual-editing-next Skipped Skipped Aug 13, 2026 3:42pm
visual-editing-next Skipped Skipped Aug 13, 2026 3:42pm
visual-editing-page-builder-demo Skipped Skipped Aug 13, 2026 3:42pm
visual-editing-studio Skipped Skipped Aug 13, 2026 3:42pm

Request Review

generateBundle ran before the CSS asset existed, so publint failed on a
missing styles.css.d.ts. Copy the declaration after the Rolldown pass
and before publint instead.

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f253722

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

This PR includes changesets to release 1 package
Name Type
@sanity/visual-editing-standalone Patch

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

@vercel
vercel Bot temporarily deployed to Preview – visual-editing-page-builder-demo August 13, 2026 15:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – live-visual-editing-next August 13, 2026 15:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – visual-editing-studio August 13, 2026 15:42 Inactive
@vercel
vercel Bot temporarily deployed to Preview – visual-editing-next August 13, 2026 15:42 Inactive
@stipsan
stipsan marked this pull request as ready for review August 13, 2026 15:59
@stipsan
stipsan merged commit 1b5e8be into main Aug 13, 2026
19 checks passed
@stipsan
stipsan deleted the cursor/standalone-styles-css-types-3280 branch August 13, 2026 15:59
@squiggler-app squiggler-app Bot mentioned this pull request Aug 13, 2026
stipsan added a commit to nuxt-modules/sanity that referenced this pull request Aug 13, 2026
Drop declare module once @sanity/visual-editing-standalone ships types
for that subpath (sanity-io/visual-editing#3630).

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 20, 2026
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