mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Update compile.ts
This commit is contained in:
parent
1720c5b1d2
commit
07a1294f52
1 changed files with 11 additions and 0 deletions
|
@ -34,6 +34,17 @@ export async function compileAstro({
|
|||
|
||||
try {
|
||||
transformResult = await compile(compileProps);
|
||||
|
||||
// Check for client: hydration directives in the compiled JSX structure
|
||||
const hasHydrationDirective = transformResult.code.includes('client:');
|
||||
if (hasHydrationDirective) {
|
||||
// Optionally log a warning or error for devs
|
||||
logger.warn(
|
||||
null,
|
||||
`Hydration directive found in ${compileProps.filename}. Astro components should not use client-side rendering.`
|
||||
);
|
||||
}
|
||||
|
||||
// Compile all TypeScript to JavaScript.
|
||||
// Also, catches invalid JS/TS in the compiled output before returning.
|
||||
esbuildResult = await transformWithEsbuild(transformResult.code, compileProps.filename, {
|
||||
|
|
Loading…
Reference in a new issue