From bc1865042de27a62a05ac86a62fb1e684cc24ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Mon, 24 Jan 2022 10:01:33 +0800 Subject: [PATCH] better const named --- configs/vite-renderer.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/vite-renderer.config.ts b/configs/vite-renderer.config.ts index 609d15b..867afcd 100644 --- a/configs/vite-renderer.config.ts +++ b/configs/vite-renderer.config.ts @@ -92,11 +92,11 @@ export function resolveElectron(dict: Parameters[0] = {}): Plugi function builtinModulesExport(modules: string[]) { return modules.map((moduleId) => { const nodeModule = require(moduleId) - const requireTpl = `const __builtinModule = require("${moduleId}");` + const requireModule = `const __builtinModule = require("${moduleId}");` const exportDefault = `export default __builtinModule` const exportMembers = Object.keys(nodeModule).map(attr => `export const ${attr} = __builtinModule.${attr}`).join(';\n') + ';' const nodeModuleCode = ` -${requireTpl} +${requireModule} ${exportDefault}