File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/plugin-rsc/examples/basic/src Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,17 @@ import './styles.css'
44export default async function handler ( request : Request ) : Promise < Response > {
55 const url = new URL ( request . url )
66 const { Root } = await import ( './routes/root.tsx' )
7+ const nonce = ! process . env . NO_CSP ? crypto . randomUUID ( ) : undefined
8+ // https://vite.dev/guide/features.html#content-security-policy-csp
9+ // this isn't needed if `style-src: 'unsafe-inline'` (dev) and `script-src: 'self'`
10+ const nonceMeta = nonce && < meta property = "csp-nonce" nonce = { nonce } />
711 const root = (
812 < >
913 { import . meta. viteRsc . loadCss ( ) }
14+ { nonceMeta }
1015 < Root url = { url } />
1116 </ >
1217 )
13- const nonce = ! process . env . NO_CSP ? crypto . randomUUID ( ) : undefined
1418 const response = await handleRequest ( {
1519 request,
1620 getRoot : ( ) => root ,
You can’t perform that action at this time.
0 commit comments