Skip to content

Commit 5bbb5fa

Browse files
Mac Minimichaelbe812
authored andcommitted
chore(core): satisfy lint by using file URL dynamic import for built-in plugin fallback (remove require)
1 parent 72016bc commit 5bbb5fa

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

packages/core/src/lib/plugin-loader.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,9 @@ export async function loadPlugin(
101101
for (const p of fallbackPaths) {
102102
try {
103103
logger.debug(`Attempting to load from: ${p}`);
104-
let mod2: { default?: unknown } | undefined;
105-
try {
106-
// Prefer require for CJS outputs
107-
// eslint-disable-next-line @typescript-eslint/no-var-requires
108-
mod2 = require(p);
109-
} catch {
110-
const { pathToFileURL } = await import('node:url');
111-
const url = pathToFileURL(p).href;
112-
mod2 = (await import(url)) as { default?: unknown };
113-
}
104+
const { pathToFileURL } = await import('node:url');
105+
const url = pathToFileURL(p).href;
106+
const mod2 = (await import(url)) as { default?: unknown };
114107

115108
if (isGeneratorPlugin(mod2?.default)) {
116109
const plugin2 = mod2.default;

0 commit comments

Comments
 (0)