Skip to content

Commit

Permalink
fix: use pathToFileURL for imports from the FS
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Feb 6, 2025
1 parent c62dd48 commit c49a8de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/myst-cli/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'node:fs';
const { pathToFileURL } = require('node:url');

Check failure on line 2 in packages/myst-cli/src/plugins.ts

View workflow job for this annotation

GitHub Actions / lint

Require statement not part of import statement
import type { ISession } from './session/types.js';
import { selectors } from './store/index.js';
import { RuleId, plural, type MystPlugin, type ValidatedMystPlugin } from 'myst-common';
Expand Down Expand Up @@ -97,8 +98,9 @@ export async function loadPlugins(session: ISession): Promise<ValidatedMystPlugi
return null;
}
let module: any;
const pathURL = pathToFileURL(path);
try {
module = await import(path);
module = await import(pathURL);
} catch (error) {
session.log.debug(`\n\n${(error as Error)?.stack}\n\n`);
addWarningForFile(session, path, `Error reading plugin: ${error}`, 'error', {
Expand Down

0 comments on commit c49a8de

Please sign in to comment.