ESM support: soliciting feedback
Please use this ticket to provide feedback on our native ESM support. Your involvement is greatly appreciated to ensure the feature works on real-world projects. ## Experimental warning [Node's loader hooks](https://nodejs.org/api/esm.html#esm_experimental_loaders) are **EXPERIMENTAL** and subject to change. ts-node's ESM support is as stable as it can be, but it relies on APIs which node can *and will* break in new versions of node. When node breaks their APIs, it breaks loaders using their APIs. You have been warned! ## Third-party docs: "Guide: ES Modules in NodeJS" Someone has been maintaining a great reference document explaining how to use ts-node's ESM loader. [Guide: ES Modules in NodeJS](https://docs.joshuatz.com/cheatsheets/node-and-npm/node-esm/) ## First-party docs Our website explains the basics: [CommonJS vs native ECMAScript modules](https://typestrong.org/ts-node/docs/imports) [Options: esm](https://typestrong.org/ts-node/docs/options#esm) ## Usage ### Requirements * Set `"module": "ESNext"` or `"ES2015"` so that TypeScript emits import/export syntax. * Set `"type": "module"` in your `package.json`, which is required to tell node that .js files are ESM instead of CommonJS. To be compatible with editors, the compiler, and the TypeScript ecosystem, we cannot name our source files `.mts` nor `.mjs`. * Include file extensions in your `import` statements, or pass `--experimental-specifier-resolution=node` Idiomatic TypeScript should import `foo.ts`
Posted by cspotcode on Apr 12, 2020, 5:50 AM
Tags
Related issues
- Add 65536 size support for maps
- TypeScript 7.1 Iteration Plan
- nvim-treeconfig: upstream nvim-treesitter
- Add the "action" and "method" attributes to <button>
- [FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
- > We were imposed GitHub for so many exercises!
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
support (Software)
Add 65536 size support for maps
TypeScript 7.1 Iteration Plan
nvim-treeconfig: upstream nvim-treesitter
Add the "action" and "method" attributes to <button>
[FEATURE] Support multiple Connector accounts (same connector, different accounts) in Claude and Claude Code on the web (claude.ai/code)
> We were imposed GitHub for so many exercises!
Add support for Visual Studio 2026 Integration
Support for Helm v4
ESM support: soliciting feedback
Please use this ticket to provide feedback on our native ESM support. Your involvement is greatly appreciated to ensure the feature works on real-world projects. ## Experimental warning [Node's loader hooks](https://nodejs.org/api/esm.html#esm_experimental_loaders) are **EXPERIMENTAL** and subject to change. ts-node's ESM support is as stable as it can be, but it relies on APIs which node can *and will* break in new versions of node. When node breaks their APIs, it breaks loaders using their APIs. You have been warned! ## Third-party docs: "Guide: ES Modules in NodeJS" Someone has been maintaining a great reference document explaining how to use ts-node's ESM loader. [Guide: ES Modules in NodeJS](https://docs.joshuatz.com/cheatsheets/node-and-npm/node-esm/) ## First-party docs Our website explains the basics: [CommonJS vs native ECMAScript modules](https://typestrong.org/ts-node/docs/imports) [Options: esm](https://typestrong.org/ts-node/docs/options#esm) ## Usage ### Requirements * Set `"module": "ESNext"` or `"ES2015"` so that TypeScript emits import/export syntax. * Set `"type": "module"` in your `package.json`, which is required to tell node that .js files are ESM instead of CommonJS. To be compatible with editors, the compiler, and the TypeScript ecosystem, we cannot name our source files `.mts` nor `.mjs`. * Include file extensions in your `import` statements, or pass `--experimental-specifier-resolution=node` Idiomatic TypeScript should import `foo.ts`
Comments (0)
No comments yet. Start the discussion.