File tree 1 file changed +7
-17
lines changed
1 file changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -13,23 +13,13 @@ export async function loadPlugins(
13
13
const pluginDisplay = getPluginDisplayName ( plugin ) ;
14
14
15
15
try {
16
- let instance : any ;
17
- try {
18
- // eslint-disable-next-line @typescript-eslint/no-require-imports
19
- instance = require ( plugin ) ;
20
- } catch ( error : any ) {
21
- if ( error . code === "ERR_REQUIRE_ESM" ) {
22
- // On Windows, we need to ensure this path is a file path.
23
- // Or we'll get ERR_UNSUPPORTED_ESM_URL_SCHEME
24
- const esmPath = isAbsolute ( plugin )
25
- ? pathToFileURL ( plugin ) . toString ( )
26
- : plugin ;
27
- instance = await import ( esmPath ) ;
28
- } else {
29
- throw error ;
30
- }
31
- }
32
- const initFunction = instance . load ;
16
+ // On Windows, we need to ensure this path is a file path.
17
+ // Or we'll get ERR_UNSUPPORTED_ESM_URL_SCHEME
18
+ const esmPath = isAbsolute ( plugin )
19
+ ? pathToFileURL ( plugin ) . toString ( )
20
+ : plugin ;
21
+ let instance : any = await import ( esmPath ) ;
22
+ const initFunction = instance . load || instance . default ?. load ;
33
23
34
24
if ( typeof initFunction === "function" ) {
35
25
await initFunction ( app ) ;
You can’t perform that action at this time.
0 commit comments