8000 chore: add more type-safe solution + fallback · nuxt/module-builder@66d4231 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 66d4231

Browse files
committed
chore: add more type-safe solution + fallback
1 parent 14d7788 commit 66d4231

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/commands/build.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { existsSync, promises as fsp } from 'node:fs'
22
import { pathToFileURL } from 'node:url'
3-
import { basename, dirname, join, normalize, resolve } from 'pathe'
3+
import { basename, dirname, extname, join, normalize, resolve } from 'pathe'
44
import { filename } from 'pathe/utils'
55
import { readPackageJSON } from 'pkg-types'
66
import { parse } from 'tsconfck'
@@ -135,10 +135,11 @@ export default defineCommand({
135135

136136
const normalizedId = normalize(resolved.id)
137137
for (const entry of runtimeEntries) {
138-
if (!normalizedId.includes(entry.input))
138+
if (!entry.outDir || !normalizedId.includes(entry.input))
139139
continue
140140

141-
const distFile = await resolvePath(join(dirname(pathToFileURL(normalizedId).href.replace(entry.input, entry.outDir!)), filename(normalizedId)!))
141+
const name = filename(normalizedId) || basename(normalizedId, extname(normalizedId))
142+
const distFile = await resolvePath(join(dirname(pathToFileURL(normalizedId).href.replace(entry.input, entry.outDir)), name))
142143
if (distFile) {
143144
return {
144145
external: true,

0 commit comments

Comments
 (0)
0