mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix: require
This commit is contained in:
4
index.ts
4
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);
|
||||
});
|
||||
}
|
||||
|
||||
@ -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<void>;
|
||||
// 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<void>;
|
||||
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<void>;
|
||||
// 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<void>;
|
||||
run(options);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user