File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1+ const url = require ( 'url' ) ;
2+
13async function supportsDynamicImport ( ) {
24 try {
35 // imports are cached.
@@ -20,8 +22,13 @@ async function supportsDynamicImport() {
2022async function importModule ( modulePath ) {
2123 // JSON modules are still behind a flag. Fallback to require for now.
2224 // https://nodejs.org/api/esm.html#json-modules
23- if ( ! modulePath . endsWith ( '.json' ) && ( await supportsDynamicImport ( ) ) ) {
24- return import ( modulePath ) ;
25+ if (
26+ url . pathToFileURL &&
27+ ! modulePath . endsWith ( '.json' ) &&
28+ ( await supportsDynamicImport ( ) )
29+ ) {
30+ // 'import' expects a URL. (https://github.com/sequelize/cli/issues/994)
31+ return import ( url . pathToFileURL ( modulePath ) ) ;
2532 }
2633
2734 // mimics what `import()` would return for
You can’t perform that action at this time.
0 commit comments