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
+
1
3
async function supportsDynamicImport ( ) {
2
4
try {
3
5
// imports are cached.
@@ -20,8 +22,13 @@ async function supportsDynamicImport() {
20
22
async function importModule ( modulePath ) {
21
23
// JSON modules are still behind a flag. Fallback to require for now.
22
24
// 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 ) ) ;
25
32
}
26
33
27
34
// mimics what `import()` would return for
You can’t perform that action at this time.
0 commit comments