mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 20:07:06 +08:00
better const named
This commit is contained in:
parent
1c175360cf
commit
bc1865042d
@ -92,11 +92,11 @@ export function resolveElectron(dict: Parameters<typeof resolve>[0] = {}): Plugi
|
|||||||
function builtinModulesExport(modules: string[]) {
|
function builtinModulesExport(modules: string[]) {
|
||||||
return modules.map((moduleId) => {
|
return modules.map((moduleId) => {
|
||||||
const nodeModule = require(moduleId)
|
const nodeModule = require(moduleId)
|
||||||
const requireTpl = `const __builtinModule = require("${moduleId}");`
|
const requireModule = `const __builtinModule = require("${moduleId}");`
|
||||||
const exportDefault = `export default __builtinModule`
|
const exportDefault = `export default __builtinModule`
|
||||||
const exportMembers = Object.keys(nodeModule).map(attr => `export const ${attr} = __builtinModule.${attr}`).join(';\n') + ';'
|
const exportMembers = Object.keys(nodeModule).map(attr => `export const ${attr} = __builtinModule.${attr}`).join(';\n') + ';'
|
||||||
const nodeModuleCode = `
|
const nodeModuleCode = `
|
||||||
${requireTpl}
|
${requireModule}
|
||||||
|
|
||||||
${exportDefault}
|
${exportDefault}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user