Skip to content

Commit b2f6343

Browse files
committed
try using require
1 parent 86f4c02 commit b2f6343

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/scaffold-config/src/ct-detect-third-party.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import path from 'path'
2-
import { pathToFileURL } from 'url'
32
import globby from 'globby'
43
import { z } from 'zod'
54
import Debug from 'debug'
@@ -34,15 +33,16 @@ const CT_FRAMEWORK_GLOB = path.join('node_modules', 'cypress-ct-*', 'package.jso
3433
// is used (e.g. module=node16). To change this, we would also have to change the ts-node behavior when requiring the
3534
// Cypress config file. This hack for keeping dynamic imports from being converted works across all
3635
// of our supported node versions
37-
const _dynamicImport = new Function('specifier', 'return import(specifier)')
3836

39-
const dynamicImport = <T>(module: string) => {
40-
return _dynamicImport(module) as Promise<T>
41-
}
37+
// const _dynamicImport = new Function('specifier', 'return import(specifier)')
4238

43-
const dynamicAbsoluteImport = (filePath: string) => {
44-
return dynamicImport(pathToFileURL(filePath).href) as Promise<any>
45-
}
39+
// const dynamicImport = <T>(module: string) => {
40+
// return _dynamicImport(module) as Promise<T>
41+
// }
42+
43+
// const dynamicAbsoluteImport = (filePath: string) => {
44+
// return dynamicImport(pathToFileURL(filePath).href) as Promise<any>
45+
// }
4646

4747
/**
4848
* When compiling CJS -> ESM, TS can produce:
@@ -94,7 +94,9 @@ export async function detectThirdPartyCTFrameworks (
9494

9595
debug('Resolve successful: %s', modulePath)
9696

97-
const m = await dynamicAbsoluteImport(modulePath)
97+
debug('require(%s)', modulePath)
98+
99+
const m = require(modulePath)
98100

99101
debug('Imported %o', m)
100102

0 commit comments

Comments
 (0)