Skip to content

fix(ssr): project the CSP nonce locally instead of importing scriptNonce/styleNonce - #409

Merged
ryansolid merged 1 commit into
nextfrom
fix/nonce-pass-through
Oct 13, 2026
Merged

ryansolid merged 1 commit into
nextfrom
fix/nonce-pass-through

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Summary

Before: the generated start-mode server handler imports scriptNonce and styleNonce from @solidjs/web. solidjs/solid#4016 makes those helpers internal, because HydrationScript, generateHydrationScript and createSSRResponse now take the full CSPNonce themselves. Without the exports, every start-mode build fails with MISSING_EXPORT "scriptNonce".

After: the handler projects each destination of a { script, style } nonce with a local destinationNonce helper and no longer imports the two functions. Behaviour is unchanged: the client entry and dev scripts take the script half, dev styles and the csp-nonce meta take the style half, and createSSRResponse still gets the script half. That works with every @solidjs/web release, before and after #4016.

Once this ships, solidjs/solid can drop the two exports for good.

How did you test this change?

  • pnpm build passes. The built dist/esm/index.mjs has no scriptNonce/styleNonce references.
  • In the solid monorepo, I swapped this build in for the published 3.0.0-next.49 and built examples/hackernews against a @solidjs/web with the two exports removed. The build succeeds; with the published plugin it fails with MISSING_EXPORT.

🤖 Generated with Claude Code

https://claude.ai/code/session_018LY7F9czoRqdMEvk2QwPr1


Generated by Claude Code

…nce/styleNonce

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018LY7F9czoRqdMEvk2QwPr1
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6732a5f

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

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin 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

@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@409

commit: 6732a5f

@ryansolid
ryansolid merged commit 253483d into next Oct 13, 2026
6 checks passed
Sign up for free to 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.

1 participant