Skip to content

Commit 7782991

Browse files
authored
fix: add meaningful errors to client manifest normalizer (#17)
1 parent 2054a26 commit 7782991

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/renderer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ export function normalizeClientManifest (manifest: ClientManifest | LegacyClient
136136
// Prepare first entrypoint to receive extra data
137137
const first = getIdentifier(manifest.initial.find(isJS)!)
138138
if (first) {
139+
if (!(first in clientManifest)) {
140+
throw new Error(
141+
`Invalid manifest - initial entrypoint not in \`all\`: ${manifest.initial.find(isJS)}`
142+
)
143+
}
139144
clientManifest[first].css = []
140145
clientManifest[first].assets = []
141146
clientManifest[first].dynamicImports = []
@@ -154,6 +159,9 @@ export function normalizeClientManifest (manifest: ClientManifest | LegacyClient
154159
for (const outfile of manifest.async) {
155160
if (isJS(outfile)) {
156161
const identifier = getIdentifier(outfile)
162+
if (!(identifier in clientManifest)) {
163+
throw new Error(`Invalid manifest - async module not in \`all\`: ${outfile}`)
164+
}
157165
clientManifest[identifier].isDynamicEntry = true
158166
clientManifest[first].dynamicImports!.push(identifier)
159167
} else if (first) {

0 commit comments

Comments
 (0)