From 83bb1bb8df36957f3aba3de2fc2dd8b0df01e7ea Mon Sep 17 00:00:00 2001 From: underfin Date: Thu, 11 Jul 2024 11:09:45 +0800 Subject: [PATCH] chore: enable format iife --- packages/vite/src/node/build.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index 63f5169c2e6dd2..333a1921f76013 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -271,7 +271,7 @@ export interface LibraryOptions { fileName?: string | ((format: ModuleFormat, entryName: string) => string) } -export type LibraryFormats = 'es' | 'cjs' /*| 'umd' | 'iife' | 'system'*/ +export type LibraryFormats = 'es' | 'cjs' | 'iife' /*| 'umd' | 'system'*/ export interface ModulePreloadOptions { /** @@ -1162,7 +1162,7 @@ const relativeUrlMechanisms: Record< getResolveUrl( `'${escapeId(partialEncodeURIPath(relativePath))}', import.meta.url`, ), - // iife: (relativePath) => getRelativeUrlFromDocument(relativePath), + iife: (relativePath) => getRelativeUrlFromDocument(relativePath), // // NOTE: make sure rollup generate `module` params // system: (relativePath) => // getResolveUrl( @@ -1234,7 +1234,7 @@ export function createToImportMetaURLBasedRelativeRuntime( format: InternalModuleFormat, isWorker: boolean, ): (filename: string, importer: string) => { runtime: string } { - const formatLong = /* isWorker && format === 'iife' ? 'worker-iife' : */ format + const formatLong = isWorker && format === 'iife' ? 'worker-iife' : format const toRelativePath = customRelativeUrlMechanisms[formatLong] return (filename, importer) => ({ runtime: toRelativePath(