Relative Content

Tag Archive for node.jstypescriptts-node

Can code files with a .cts extension in Node.js use module syntax for imports and exports?

I created a new Node.js project with Node version 18.15.0. In the package.json, I added the field “type”: “module”. { “name”: “ts-node-test”, “version”: “1.0.0”, “description”: “”, “type”: “module”, “scripts”: { “test”: “cross-env NODE_OPTIONS=”–loader ts-node/esm” node index.cts” }, “author”: “”, “license”: “ISC”, “devDependencies”: { “cross-env”: “^7.0.3”, “ts-node”: “^10.9.2”, “tslib”: “^2.6.2”, “typescript”: “^5.4.5” }, “volta”: { “node”: […]