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 · 2 comments
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.

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jul 10, 2024
@AtofStryker AtofStryker removed the stale no activity on this issue for a long period label Jul 10, 2024
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

3 participants