mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +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);
|
console.log('Loaded plugin - ' + plugin);
|
||||||
const pluginPath = path.join(__dirname, 'plugins', plugin, 'back.js');
|
const pluginPath = path.join(__dirname, 'plugins', plugin, 'back.js');
|
||||||
fileExists(pluginPath, () => {
|
fileExists(pluginPath, () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access
|
||||||
const handle = require(pluginPath) as (window: BrowserWindow, option: typeof options) => void;
|
const handle = require(pluginPath).default as (window: BrowserWindow, option: typeof options) => void;
|
||||||
handle(win, options);
|
handle(win, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,8 @@ plugins.forEach(async ([plugin, options]) => {
|
|||||||
'preload.js',
|
'preload.js',
|
||||||
) as string;
|
) as string;
|
||||||
fileExists(preloadPath, () => {
|
fileExists(preloadPath, () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access
|
||||||
const run = require(preloadPath) as (config: typeof options) => Promise<void>;
|
const run = require(preloadPath).default as (config: typeof options) => Promise<void>;
|
||||||
run(options);
|
run(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
'front.js',
|
'front.js',
|
||||||
) as string;
|
) as string;
|
||||||
fileExists(pluginPath, () => {
|
fileExists(pluginPath, () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-member-access
|
||||||
const run = require(pluginPath) as (config: typeof options) => Promise<void>;
|
const run = require(pluginPath).default as (config: typeof options) => Promise<void>;
|
||||||
run(options);
|
run(options);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user