fix(visual-editing-standalone): type the styles.css export - #3630
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
10 Skipped Deployments
|
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 detectedLatest commit: f253722 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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
Bot
temporarily deployed
to
Preview – visual-editing-page-builder-demo
August 13, 2026 15:42
Inactive
vercel
Bot
temporarily deployed
to
Preview – live-visual-editing-next
August 13, 2026 15:42
Inactive
stipsan
marked this pull request as ready for review
August 13, 2026 15:59
Merged
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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Consumers such as
nuxt-modules/sanity#1530had to add:TypeScript 6 enables
noUncheckedSideEffectImportsby default (and@sanity/tsconfig/strictestturns it on), soimport '@sanity/visual-editing-standalone/styles.css'fails unless the package ships types for that subpath.Change
Publish
./styles.cssas:{ "types": "./dist/styles.css.d.ts", "default": "./dist/styles.css" }typesis a side-effect declaration (export {}), so consumers no longer need a localdeclare module.defaultstays 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
distafter the Rolldown pass (and before publint). Emitting it fromgenerateBundleis too early: the CSS asset is not in the bundle yet.Test plan
distcontract +typeof import('@sanity/visual-editing-standalone/styles.css'))pnpm --filter @sanity/visual-editing-standalone build(publint clean)declare module '@sanity/visual-editing-standalone/styles.css'