Skip to content

Commit 6037b93

Browse files
committed
fix(vite): ignore when client entry cannot be resolved
1 parent 78bfb41 commit 6037b93

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/vite/src/plugins/module-preload-polyfill.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ export function ModulePreloadPolyfillPlugin (): Plugin {
1212
name: 'nuxt:module-preload-polyfill',
1313
applyToEnvironment: environment => environment.name === 'client',
1414
configResolved (config) {
15-
isDisabled = config.build.modulePreload === false || config.build.modulePreload.polyfill === false
16-
sourcemap = !!config.build.sourcemap
17-
entry = resolveClientEntry(config)
15+
try {
16+
isDisabled = config.build.modulePreload === false || config.build.modulePreload.polyfill === false
17+
sourcemap = !!config.build.sourcemap
18+
entry = resolveClientEntry(config)
19+
} catch {
20+
console.debug('[nuxt:module-preload-polyfill] Could not resolve client entry, module preload polyfill will not be injected.')
21+
}
1822
},
1923
transform (code, id) {
2024
if (isDisabled || id.replace(QUERY_RE, '') !== entry) { return }

packages/vite/src/plugins/type-check.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ export function TypeCheckPlugin (nuxt: Nuxt): Plugin {
1515
return !nuxt.options.test && nuxt.options.typescript.typeCheck === true
1616
},
1717
configResolved (config) {
18-
entry = resolveClientEntry(config)
19-
sourcemap = !!config.build.sourcemap
18+
try {
19+
entry = resolveClientEntry(config)
20+
sourcemap = !!config.build.sourcemap
21+
} catch {
22+
console.debug('[nuxt:type-check] Could not resolve client entry, type checking will not be applied.')
23+
}
2024
},
2125
transform (code, id) {
2226
if (id.replace(QUERY_RE, '') !== entry) { return }

0 commit comments

Comments
 (0)