Skip to content

Commit 65aa171

Browse files
committed
fix(webpack): handle null result from webpack call
1 parent 7e4aad5 commit 65aa171

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/webpack/src/webpack.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
6666
const compiler = webpack(config)
6767

6868
// In dev, write files in memory FS
69-
if (nuxt.options.dev) {
69+
if (nuxt.options.dev && compiler) {
7070
compiler.outputFileSystem = mfs! as unknown as Compiler['outputFileSystem']
7171
}
7272

@@ -75,18 +75,20 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
7575

7676
nuxt.hook('close', async () => {
7777
for (const compiler of compilers) {
78-
await new Promise(resolve => compiler.close(resolve))
78+
await new Promise(resolve => compiler?.close(resolve))
7979
}
8080
})
8181

8282
// Start Builds
8383
if (nuxt.options.dev) {
84-
await Promise.all(compilers.map(c => compile(c)))
84+
await Promise.all(compilers.map(c => c && compile(c)))
8585
return
8686
}
8787

8888
for (const c of compilers) {
89-
await compile(c)
89+
if (c) {
90+
await compile(c)
91+
}
9092
}
9193
}
9294

0 commit comments

Comments
 (0)