Skip to content

Commit

Permalink
fix(nuxt): resolve vite config after all modules have injected plugins (
Browse files Browse the repository at this point in the history
#246)

* test: auto-import

* fix(nuxt): add config plugin last

Co-authored-by: Daniel Roe <[email protected]>
  • Loading branch information
Akryum and danielroe authored Aug 17, 2022
1 parent 3466975 commit cefa4f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions examples/nuxt3/cypress/e2e/render-story.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ describe('Story render', () => {
cy.visit('/story/components-simple-story-vue?variantId=_default')
getIframeBody().contains('Simple story in Nuxt NuxtLink')
})

it('should render auto-imported components', () => {
cy.visit('/story/components-autoimport-story-vue?variantId=_default')
getIframeBody().contains('Meow')
})
})
8 changes: 5 additions & 3 deletions packages/histoire-plugin-nuxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ async function useNuxtViteConfig () {
}
return {
viteConfig: await new Promise<ViteConfig>((resolve) => {
nuxt.hook('vite:extendConfig', (config, { isClient }) => {
// @ts-ignore
if (isClient) resolve({ ...config })
nuxt.hook('modules:done', () => {
nuxt.hook('vite:extendConfig', (config, { isClient }) => {
// @ts-ignore
if (isClient) resolve({ ...config })
})
})
nuxt.ready().then(async () => {
buildNuxt(nuxt)
Expand Down

0 comments on commit cefa4f9

Please sign in to comment.