From 12825d8bf25a668bb21e9a5a963680d69c4d4394 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 4 Sep 2023 02:30:16 +0900 Subject: [PATCH] fix: require --- index.ts | 4 ++-- preload.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.ts b/index.ts index ddb892f6..22066606 100644 --- a/index.ts +++ b/index.ts @@ -103,8 +103,8 @@ function loadPlugins(win: BrowserWindow) { console.log('Loaded plugin - ' + plugin); const pluginPath = path.join(__dirname, 'plugins', plugin, 'back.js'); fileExists(pluginPath, () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const handle = require(pluginPath) as (window: BrowserWindow, option: typeof options) => void; + // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access + const handle = require(pluginPath).default as (window: BrowserWindow, option: typeof options) => void; handle(win, options); }); } diff --git a/preload.ts b/preload.ts index b8da3363..d14e23db 100644 --- a/preload.ts +++ b/preload.ts @@ -29,8 +29,8 @@ plugins.forEach(async ([plugin, options]) => { 'preload.js', ) as string; fileExists(preloadPath, () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const run = require(preloadPath) as (config: typeof options) => Promise; + // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access + const run = require(preloadPath).default as (config: typeof options) => Promise; run(options); }); @@ -64,8 +64,8 @@ document.addEventListener('DOMContentLoaded', () => { 'front.js', ) as string; fileExists(pluginPath, () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const run = require(pluginPath) as (config: typeof options) => Promise; + // eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access + const run = require(pluginPath).default as (config: typeof options) => Promise; run(options); }); });