feat: supports ES build target for renderer #174

This commit is contained in:
alex8088 2023-06-03 22:18:48 +08:00
parent c26a9ff71c
commit 6dff3475b4

View file

@ -306,8 +306,8 @@ export function electronRendererVitePlugin(options?: ElectronPluginOptions): Plu
throw new Error('build target required for the electron vite renderer config')
} else {
const targets = Array.isArray(build.target) ? build.target : [build.target]
if (targets.some(t => !t.startsWith('chrome'))) {
throw new Error('the electron vite renderer config build target must be chrome')
if (targets.some(t => !t.startsWith('chrome') && !/^es((202\d{1})|next)$/.test(t))) {
throw new Error('the electron vite renderer config build target must be chrome? or es?')
}
}