Skip to content

Commit

Permalink
refactor: replace includes with logical operations (#17620)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea authored Jul 15, 2024
1 parent d8a5d70 commit c4a2227
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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".',
)
Expand Down
5 changes: 4 additions & 1 deletion packages/vite/src/node/plugins/workerImportMetaUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c4a2227

Please # to comment.