diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 75f207482d010c..1ef0dcddbb93a1 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -920,7 +920,10 @@ export function resolveBuildOutputs( } outputs.forEach((output) => { - if (['umd', 'iife'].includes(output.format!) && !output.name) { + if ( + (output.format === 'umd' || output.format === 'iife') && + !output.name + ) { throw new Error( 'Entries in "build.rollupOptions.output" must specify "name" when the format is "umd" or "iife".', ) diff --git a/packages/vite/src/node/plugins/workerImportMetaUrl.ts b/packages/vite/src/node/plugins/workerImportMetaUrl.ts index 22a5de2ec67b06..4065c6470aca98 100644 --- a/packages/vite/src/node/plugins/workerImportMetaUrl.ts +++ b/packages/vite/src/node/plugins/workerImportMetaUrl.ts @@ -82,7 +82,10 @@ function getWorkerType(raw: string, clean: string, i: number): WorkerType { } const workerOpts = parseWorkerOptions(workerOptString, commaIndex + 1) - if (workerOpts.type && ['classic', 'module'].includes(workerOpts.type)) { + if ( + workerOpts.type && + (workerOpts.type === 'module' || workerOpts.type === 'classic') + ) { return workerOpts.type }