Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript with esm does not work with certain tsconfig.json values #28696

Open
AtofStryker opened this issue Jan 11, 2024 · 1 comment
Open

Comments

@AtofStryker
Copy link
Contributor

Current behavior

Cypress is unable to run typescript/esm projects when certain values are set in the tsconfig.json. This tsconfig.json does not work with ESM when setting type: "module" in the package.json.

{
    "compilerOptions": {
      "target": "es5",
      "lib": ["dom", "dom.iterable", "esnext"],
      "allowJs": true,
      "skipLibCheck": true,
      "strict": true,
      "forceConsistentCasingInFileNames": true,
      "noEmit": true,
      "esModuleInterop": true,
      "module": "es6",
      "moduleResolution": "node",
      "resolveJsonModule": true,
      "isolatedModules": true,
      "jsx": "preserve",
      "incremental": true,
      "plugins": [{ "name": "next" }],
      "paths": { "@/*": ["./*"] }
    },
    "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
    "exclude": ["node_modules"]
  }

To workaround this issue, either comment out allowJs or bump the target to ES6 or greater

Desired behavior

Cypress should be able to run ESM with typescript regardless of the values in my tsconfig.json

Test code to reproduce

https://github.com/AtofStryker/module_reprod_ts

Cypress Version

13.6.2

Node version

v18.15.0

Operating System

macOS 13.5.1 intel

Debug Logs

Useful for debugging:


DEBUG=cypress:lifecycle:ProjectConfigIpc,cypress:server:register-ts-node,cypress:config:addToCypressConfig,cypress:lifecycle:child:run_require_async_child*,cypress:config:addToCypressConfigPlugin npx cypress open


### Other

_No response_
@AtofStryker
Copy link
Contributor Author

This is identical to the tsconfig.json found in the nextjs@14 scaffolding besides the module and moduleResolution. The same issue would still apply if type: "module" were configured for #27731 reproduction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants