Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 1b07abe

Browse files
authored
fix: use webpack:config to add entry for better nuxt/storybook compatibility (#495)
closes #494
1 parent 5338889 commit 1b07abe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/module/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Module, NuxtOptions } from '@nuxt/types'
22
import { resolve } from 'upath'
3-
import type { Compiler } from 'webpack'
3+
import type { Configuration } from 'webpack'
44

55
import { name, version } from '../../package.json'
66

@@ -40,9 +40,11 @@ const compositionApiModule: Module<never> = function compositionApiModule() {
4040
// Register the Vue Composition API for webpack
4141

4242
const registration = addResolvedTemplate.call(this, 'register.mjs')
43-
this.nuxt.hook('build:compile', ({ compiler }: { compiler: Compiler }) => {
44-
const entry = compiler.options.entry as Record<string, string[]>
45-
entry.app.unshift(registration)
43+
this.nuxt.hook('webpack:config', (config: Configuration[]) => {
44+
config.forEach(config => {
45+
const entry = config.entry as Record<string, string[]>
46+
entry.app.unshift(registration)
47+
})
4648
})
4749

4850
// Turn off webpack4 module context for .mjs files (as it appears to have some issues)

0 commit comments

Comments
 (0)