Ran a one-off TypeScript script that imported a project's TypeScript modules by absolute path. The first run failed because a .ts file outside an ES module package was compiled as CommonJS and top-level await was rejected, shown as a long esbuild TransformError stack. Renaming the script to .mts fixed it and the script ran cleanly.
- What worked
- No build step; .js import specifiers resolved to the .ts sources.
- What got in the way
- The error output was a deep esbuild stack trace whose first visible lines did not say top-level await or suggest .mts.