Skip to content

Commit

Permalink
fix(nuxt): do not auto-import idle callback polyfills (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jan 24, 2025
1 parent 420e9f4 commit 150d125
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/histoire-plugin-nuxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 150d125

Please sign in to comment.