File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 "build" : " astro build" ,
1111 "generate:props" : " tsx scripts/extract-props.ts" ,
1212 "preview" : " astro preview" ,
13- "postinstall" : " sed -i '' \" s/vnode.type !== ClientOnlyPlaceholder:/vnode.type !== ClientOnlyPlaceholder \\ & \\ & !vnode.type.includes('-'):/ \" node_modules/ astro/dist/runtime/server/jsx.js "
13+ "postinstall" : " node scripts/patch- astro.mjs "
1414 },
1515 "dependencies" : {
1616 "@astrojs/mdx" : " ^5.0.3" ,
Original file line number Diff line number Diff line change 1+ import { readFileSync , writeFileSync } from 'node:fs' ;
2+
3+ const file = 'node_modules/astro/dist/runtime/server/jsx.js' ;
4+ const content = readFileSync ( file , 'utf8' ) ;
5+ const patched = content . replace (
6+ 'vnode.type !== ClientOnlyPlaceholder:' ,
7+ "vnode.type !== ClientOnlyPlaceholder && !vnode.type.includes('-'):"
8+ ) ;
9+
10+ if ( content === patched ) {
11+ console . log ( '⚠️ Astro patch target not found — may already be fixed or changed' ) ;
12+ } else {
13+ writeFileSync ( file , patched ) ;
14+ console . log ( '✅ Patched astro JSX handler for custom element hydration' ) ;
15+ }
You can’t perform that action at this time.
0 commit comments