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',