Skip to content

Commit c4a2227

Browse files
authoredJul 15, 2024··
refactor: replace includes with logical operations (#17620)
1 parent d8a5d70 commit c4a2227

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎packages/vite/src/node/build.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,10 @@ export function resolveBuildOutputs(
920920
}
921921

922922
outputs.forEach((output) => {
923-
if (['umd', 'iife'].includes(output.format!) && !output.name) {
923+
if (
924+
(output.format === 'umd' || output.format === 'iife') &&
925+
!output.name
926+
) {
924927
throw new Error(
925928
'Entries in "build.rollupOptions.output" must specify "name" when the format is "umd" or "iife".',
926929
)

‎packages/vite/src/node/plugins/workerImportMetaUrl.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ function getWorkerType(raw: string, clean: string, i: number): WorkerType {
8282
}
8383

8484
const workerOpts = parseWorkerOptions(workerOptString, commaIndex + 1)
85-
if (workerOpts.type && ['classic', 'module'].includes(workerOpts.type)) {
85+
if (
86+
workerOpts.type &&
87+
(workerOpts.type === 'module' || workerOpts.type === 'classic')
88+
) {
8689
return workerOpts.type
8790
}
8891

0 commit comments

Comments
 (0)
Please sign in to comment.