refactor: use dynamic import directly
This commit is contained in:
parent
5de87d681b
commit
b578f61f1c
|
@ -19,7 +19,7 @@ import { electronMainVitePlugin, electronPreloadVitePlugin, electronRendererVite
|
|||
import assetPlugin from './plugins/asset'
|
||||
import workerPlugin from './plugins/worker'
|
||||
import esmShimPlugin from './plugins/esm'
|
||||
import { isObject, dynamicImport } from './utils'
|
||||
import { isObject } from './utils'
|
||||
|
||||
export { defineConfig as defineViteConfig } from 'vite'
|
||||
|
||||
|
@ -392,7 +392,7 @@ async function loadConfigFormBundledFile(
|
|||
|
||||
const fileUrl = pathToFileURL(fileNameTmp)
|
||||
try {
|
||||
return (await dynamicImport(fileUrl)).default
|
||||
return (await import(fileUrl.href)).default
|
||||
} finally {
|
||||
try {
|
||||
fs.unlinkSync(fileNameTmp)
|
||||
|
|
|
@ -9,8 +9,6 @@ export function isObject(value: unknown): value is Record<string, unknown> {
|
|||
return Object.prototype.toString.call(value) === '[object Object]'
|
||||
}
|
||||
|
||||
export const dynamicImport = new Function('file', 'return import(file)')
|
||||
|
||||
export const wildcardHosts = new Set(['0.0.0.0', '::', '0000:0000:0000:0000:0000:0000:0000:0000'])
|
||||
|
||||
export function resolveHostname(optionsHost: string | boolean | undefined): string {
|
||||
|
|
Loading…
Reference in a new issue