fix: config via build.lib fails when default entry point not found (#393)

This commit is contained in:
alex8088 2024-03-01 23:06:09 +08:00
parent 27ade03acf
commit ad891af811

View file

@ -11,7 +11,7 @@ export interface ElectronPluginOptions {
root?: string
}
function findLibEntry(root: string, scope: string): string {
function findLibEntry(root: string, scope: string): string | undefined {
for (const name of ['index', scope]) {
for (const ext of ['js', 'ts', 'mjs', 'cjs']) {
const entryFile = path.resolve(root, 'src', scope, `${name}.${ext}`)
@ -20,7 +20,7 @@ function findLibEntry(root: string, scope: string): string {
}
}
}
return ''
return undefined
}
function findInput(root: string, scope = 'renderer'): string {