diff --git a/src/core/build/generateTypesDir.ts b/src/core/build/generateTypesDir.ts index 5e82d077..98c5a72e 100644 --- a/src/core/build/generateTypesDir.ts +++ b/src/core/build/generateTypesDir.ts @@ -48,22 +48,23 @@ async function writePathsDeclarationFile( config: InternalConfig, ): Promise { const filePath = resolve(config.typesDir, 'paths.d.ts'); + const unions = entrypoints + .map((entry) => { + const path = getEntrypointBundlePath( + entry, + config.outDir, + entry.inputPath.endsWith('.html') ? '.html' : '.js', + ); + return ` | "/${path}"`; + }) + .sort(); await fs.writeFile( filePath, [ '// Generated by wxt', 'type EntrypointPath =', - ...entrypoints - .map((entry) => { - const path = getEntrypointBundlePath( - entry, - config.outDir, - entry.inputPath.endsWith('.html') ? '.html' : '.js', - ); - return ` | "/${path}"`; - }) - .sort(), + ...(unions.length === 0 ? [' never'] : unions), ].join('\n') + '\n', );