Ref: #22747 -> #22747 (comment)
If you are using Yarn 3 with TypeScript and have a cypress.config.ts, it will error when opening Cypress, no matter what. You cannot work around the issue. The only fix would be to use js or mjs extensions. There's an example here: #25959
Repro: yarn3.zip
Ideally, we should correctly consume the cypress.config.ts using the strategy we use for any package manager other than Yarn 3, which seems to work great. Based on some research, this may not be possible (or maybe it is?) using our current strategy, which uses loader API for ESM and require API for CJS. I suspect the CJS might be easier to work out.
type: module does --loader
|
const tsNodeEsmLoader = `--experimental-specifier-resolution=node --loader ${tsNodeEsm}` |
- commonjs does
--require
|
const tsNodeLoader = `--require "${tsNode}"` |
Neither works with TS and Yarn 3.
May be relevant: yarnpkg/berry#4044
Ref: #22747 -> #22747 (comment)
If you are using Yarn 3 with TypeScript and have a
cypress.config.ts, it will error when opening Cypress, no matter what. You cannot work around the issue. The only fix would be to usejsormjsextensions. There's an example here: #25959Repro: yarn3.zip
Ideally, we should correctly consume the
cypress.config.tsusing the strategy we use for any package manager other than Yarn 3, which seems to work great. Based on some research, this may not be possible (or maybe it is?) using our current strategy, which uses loader API for ESM and require API for CJS. I suspect the CJS might be easier to work out.type: moduledoes--loadercypress/packages/data-context/src/data/ProjectConfigIpc.ts
Line 292 in 0cdd8d1
--requirecypress/packages/data-context/src/data/ProjectConfigIpc.ts
Line 306 in 0cdd8d1
Neither works with TS and Yarn 3.
May be relevant: yarnpkg/berry#4044