v0.0.64
v0.0.64
- Revert
Include file extensions in generated file imports
introduced inv0.0.61
for TypeScript users. Generated TypeScript imports will revert to the following:
- import { Foo } from './foo.pb.js';
+ import { Foo } from './foo.pb';
When targeting ESM, the TypeScript compiler expects .js
extensions and not .ts
extensions for imports because the compiler does not manipulate import paths: https://www.typescriptlang.org/docs/handbook/esm-node.html.
Including a full extension results in the following TypeScript error:
[tsserver 2691] [E] An import path cannot end with a '.ts' extension.
The TypeScript team's recommendation to use .js
extensions for .ts
file imports when targeting ESM causes a number of issues with the broader JavaScript ecosystem. Until this situation is rectified, TwirpScript will not emit ESM compliant extensions for TypeScript. This only impacts TypeScript users who wish to target ESM in Node.JS using the TypeScript compiler, as bundlers are not pedantic about file extensions. If you're impacted by this, please join the discussion in #202
Full Changelog: v0.0.63...v0.0.64