Skip to content

TypeScript and package.json type module (ESM) shows "ExperimentalWarning: --experimental-loader" #30318

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

Closed
MikeMcC399 opened this issue Sep 30, 2024 · 3 comments
Labels

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Sep 30, 2024

Current behavior

If package.json is configured with Node.js type field set to module (instead of left undefined or set to commonjs), Typescript is installed and config.cypress.ts is present, then the following warning is output when running Cypress:

DevTools listening on ws://127.0.0.1:34161/devtools/browser/b3805bff-7dbc-4403-8aa2-2b24de43ca12
(node:4680) ExperimentalWarning: --experimental-loader may be removed in the future; instead use register():
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/mike/.cache/Cypress/14.0.3/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use node --trace-warnings ... to show where the warning was created)
(node:4680) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use node --trace-deprecation ... to show where the warning was created)

Desired behavior

Cypress should not show any warning when set up as a TypeScript project and package.json includes "type": "module" for an ESM project.

Test code to reproduce

https://github.com/MikeMcC399/cypress-test-tiny/tree/30318-ts-module

git clone --branch 30318-ts-module https://github.com/MikeMcC399/cypress-test-tiny
cd cypress-test-tiny
npm ci
npx cypress run

Cypress Version

First reported on Cypress version: 13.15.0
Continues to be reproducible on version: 14.3.3

Node version

v20.17.0 and
v22.13.1 LTS (see below for additional warnings with this version)
v22.15.0 LTS

Operating System

Ubuntu 24.04.1 LTS 24.04.2 LTS

Debug Logs

DevTools listening on ws://127.0.0.1:34161/devtools/browser/b3805bff-7dbc-4403-8aa2-2b24de43ca12
(node:4680) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/mike/.cache/Cypress/14.0.3/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4680) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)

Other

Typescript version: 5.6.2 5.7.3

With Node.js v22.11.0 LTS there is an additional warning

(node:6696) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.

which comes from ts-node (see issue TypeStrong/ts-node#2116)

@moritz-baecker-integra
Copy link

I can confirm, that this happens with Windows 11 as well.

@Noxdor
Copy link

Noxdor commented Feb 14, 2025

Same issue here on [email protected]

  • OS Name: Garuda Linux
  • OS Build: rolling
  • OS Type: 64-bit
  • GNOME Version: 47
  • Windowing System: Wayland
  • Kernel Version: Linux 6.13.2-zen1-1-zen

@AtofStryker
Copy link
Contributor

going to close this issue as it will be resolved with Cypress 15, which is targeted for early July 2025

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

No branches or pull requests

5 participants