Skip to content

Commit 5cd32b1

Browse files
fix: throw if wrangler fail to determine the module type (#8472) (#8521)
Co-authored-by: Edmund Hung <[email protected]>
1 parent fe790b9 commit 5cd32b1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.changeset/cute-pianos-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: throw explicit error for unknown mimetype during `wrangler check startup`

packages/wrangler/src/check/commands.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,15 @@ async function getEntryValue(
148148

149149
function getModuleType(entry: FormDataEntryValue) {
150150
if (entry instanceof Blob) {
151-
return ModuleTypeToRuleType[mimeTypeModuleType[entry.type]];
151+
const type = ModuleTypeToRuleType[mimeTypeModuleType[entry.type]];
152+
153+
if (!type) {
154+
throw new Error(
155+
`Unable to determine module type for ${entry.type} mime type`
156+
);
157+
}
158+
159+
return type;
152160
} else {
153161
return "Text";
154162
}

0 commit comments

Comments
 (0)