From 128e59101a66e9d7fc80629c5de8e27d8121cf08 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 15 Jan 2025 15:07:48 +0000 Subject: [PATCH] fix(nuxt): do not auto-import idle callback polyfills --- packages/histoire-plugin-nuxt/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/histoire-plugin-nuxt/src/index.ts b/packages/histoire-plugin-nuxt/src/index.ts index f32586e7..d7053484 100644 --- a/packages/histoire-plugin-nuxt/src/index.ts +++ b/packages/histoire-plugin-nuxt/src/index.ts @@ -145,9 +145,10 @@ async function useNuxtViteConfig() { }) nuxt.hook('imports:sources', (presets) => { + const polyfills = ['requestIdleCallback', 'cancelIdleCallback'] const stubbedComposables = ['useNuxtApp'] for (const appPreset of presets.filter(p => p.from?.startsWith('#app'))) { - appPreset.imports = appPreset.imports.filter(i => typeof i !== 'string' || !stubbedComposables.includes(i)) + appPreset.imports = appPreset.imports.filter(i => typeof i !== 'string' || (!stubbedComposables.includes(i) && !polyfills.includes(i))) } presets.push({ from: '#build/histoire/composables.mjs',