Skip to content

Commit

Permalink
Pass url to import() rather than path
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Aug 1, 2021
1 parent 7a76101 commit 38c0eee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/plugin/factory.js
@@ -1,3 +1,4 @@
import url from 'url';
import path from 'path';
import { createRequire } from 'module';
import _ from 'lodash';
Expand Down Expand Up @@ -32,7 +33,7 @@ const load = async pluginName => {
} catch (err) {
// In some cases or tests we might need to support legacy `require.resolve`
const require = createRequire(process.cwd());
const module = await import(require.resolve(pluginName, { paths: [process.cwd()] }));
const module = await import(url.pathToFileURL(require.resolve(pluginName, { paths: [process.cwd()] })));
plugin = module.default;
}
}
Expand Down

0 comments on commit 38c0eee

Please sign in to comment.