You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Node.js type field in package.json can be defined as module, commonjs or left undefined. If the field type is defined as module, then .js files are treated as CommonJS.
node16 and nodenext are the only correct module options for all apps and libraries that are intended to run in Node.js v12 or later, whether they use ES modules or not.
Using the following in tsconfig.json appears to work
"compilerOptions": {
"module": "nodenext"/* Specify what module code is generated. */
}
however I don't have experience in TypeScript to want to be the author of a documentation change.
Also Typescript for >=v10 #5262 is still open and waiting for an experienced TypeScript user to update the documentation to cover Cypress non-legacy (Cypress 10 and above) use with TypeScript.
The text was updated successfully, but these errors were encountered:
npm create vite@latest vite-cypress-ts -- --template vanilla-ts
cd vite-cypress-ts
npm install cypress -D
npx cypress open
Select "Continue" (if prompted)
Select "E2E Testing"
Select "Continue"
Select "Electron" and then "Start E2E Testing in Electron"
Select "Create new spec"
Select "Create spec"
Select "Okay, run the spec"
Description
What would you like?
Document how to set up Cypress with TypeScript when
package.json
contains"type": "module"
.Why is this needed?
Tooling > TypeScript states that Cypress tests can be written in TypeScript and includes a section Configure tsconfig.json.
The Node.js type field in
package.json
can be defined asmodule
,commonjs
or left undefined. If the fieldtype
is defined asmodule
, then.js
files are treated as CommonJS.Other
According to https://www.typescriptlang.org/docs/handbook/modules/reference.html#the-module-compiler-option
Using the following in
tsconfig.json
appears to workhowever I don't have experience in TypeScript to want to be the author of a documentation change.
The text was updated successfully, but these errors were encountered: