chore: fix treeshaking check (#10862)

pull/10863/head
Rich Harris 1 year ago committed by GitHub
parent aec4958e4f
commit 392f7d223a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -12,6 +12,15 @@ async function bundle_code(entry) {
virtual({ virtual({
__entry__: entry __entry__: entry
}), }),
{
name: 'resolve-svelte',
resolveId(importee) {
if (importee.startsWith('svelte')) {
const entry = pkg.exports[importee.replace('svelte', '.')];
return path.resolve(entry.browser ?? entry.default);
}
}
},
nodeResolve({ nodeResolve({
exportConditions: ['production', 'import', 'browser', 'default'] exportConditions: ['production', 'import', 'browser', 'default']
}) })
@ -99,6 +108,7 @@ const without_hydration = await bundle_code(
{ filename: 'App.svelte' } { filename: 'App.svelte' }
).js.code ).js.code
); );
if (!without_hydration.includes('current_hydration_fragment')) { if (!without_hydration.includes('current_hydration_fragment')) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(`✅ Hydration code treeshakeable`); console.error(`✅ Hydration code treeshakeable`);

Loading…
Cancel
Save