fix: hide error overlay tip, log [astro] instead of [vite] (#4162)
Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
parent
e569f0a5c7
commit
9014f0f8cb
2 changed files with 9 additions and 1 deletions
|
@ -120,7 +120,7 @@ export async function render(
|
||||||
scripts.add({
|
scripts.add({
|
||||||
props: {
|
props: {
|
||||||
type: 'module',
|
type: 'module',
|
||||||
src: new URL('../../../runtime/client/hmr.js', import.meta.url).pathname,
|
src: '/@id/astro/runtime/client/hmr.js',
|
||||||
},
|
},
|
||||||
children: '',
|
children: '',
|
||||||
});
|
});
|
||||||
|
|
|
@ -406,5 +406,13 @@ export default function createPlugin({ config, logging }: AstroPluginOptions): v
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
// HACK: hide `.tip` in Vite's ErrorOverlay and replace [vite] messages with [astro]
|
||||||
|
transform(code, id, opts = {}) {
|
||||||
|
if (opts.ssr) return;
|
||||||
|
if (!id.includes('vite/dist/client/client.mjs')) return;
|
||||||
|
return code
|
||||||
|
.replace(/\.tip \{[^}]*\}/gm, '.tip {\n display: none;\n}')
|
||||||
|
.replace(/\[vite\]/g, '[astro]')
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue