fix(esm): use tsc-alias to append .js extensions to ESM imports#8594
fix(esm): use tsc-alias to append .js extensions to ESM imports#8594harshitanand wants to merge 1 commit intoBitGo:masterfrom
Conversation
kaustubhbitgo
left a comment
There was a problem hiding this comment.
From the original issue I would suggest to either use tsc-alias or bundler option as they cover multiple edge cases when it comes to resolve imports / other issues in esm.
|
Thanks for the review! Understood — the custom post-processor is brittle compared to Could you clarify which approach you'd prefer me to implement?
Happy to implement either. |
|
flushing, please reping when the fix is ready |
|
@alextse-bg Fix is ready — switched from the custom What changed:
|
|
@alextse-bg Rebased onto latest |
|
@alextse-bg Rebased onto current |
54a39e9 to
48640cf
Compare
What
Fixes ESM module resolution errors in
@bitgo/abstract-utxoand@bitgo/utxo-coreby adding.jsextensions to relative imports in compiled output.How
Uses
tsc-aliaswithfileExtensionReplacer— the standard, well-tested approach for this problem — instead of a custom post-processor script.build:esmin both modules now runstsc-alias -p tsconfig.esm.jsonaftertsctsc-alias ^1.8.10added todevDependenciesin both modulesfileExtensionReplacerconfigured under the"tsc-alias"key in each module'spackage.jsonscripts/fix-esm.jsretired (file contains a comment pointing to the new approach)tsc-aliashandles barrel re-exports, declaration files, dynamic imports, and directory index resolution — all edge cases the custom script would have missed.Testing
yarn build:esm— CLEAN (both modules)yarn test— 1942 passed, 0 failedRelated
Closes #7660