Open richvdh opened 4 days ago
Apparently, the typescript way to do this is actually to
import {foo} from "./matrix.js"`; // note js extension
The .js
is then retained in the output, but typescript is intelligent enough to use the ts file for type definitions (cf https://www.typescriptlang.org/docs/handbook/modules/reference.html#file-extension-substitution)
https://github.com/matrix-org/matrix-js-sdk/issues/4284 describes a problem wherein matrix-js-sdk no longer works in a CommonJS environment, but actually it's worse than that: it doesn't work in an ES modules environment either.
If we apply the fix from https://github.com/matrix-org/matrix-js-sdk/pull/4285, and run in an esm environment, I get:
The problem appears to be that
index.js
contains:However, the file it actually wants is
./matrix.js
, and the nodejs ESM resolver doesn't know it needs to add the extension. Likewise for every link in the project :/