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 and package.json type module (ESM) shows "ExperimentalWarning: --experimental-loader" #30318

Open
MikeMcC399 opened this issue Sep 30, 2024 · 0 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:

(node:3666) 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/13.15.0/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use node --trace-warnings ... 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

git clone --branch 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: 13.15.2

Node version

v20.17.0 LTS

Operating System

Ubuntu 24.04.1 LTS

Debug Logs

(node:3666) 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/13.15.0/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)

Other

Typescript version: 5.6.2

With Node.js 22.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)

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

2 participants