LeDDGroup / typescript-transform-paths

Transforms module resolution paths using TypeScript path mapping and/or custom paths
MIT License
465 stars 22 forks source link

[Bug] Import assertion is not supported #157

Closed vladimiry closed 1 year ago

vladimiry commented 2 years ago

The import assertion thing was added in TS by https://github.com/microsoft/TypeScript/commit/ec114b8931bf1ad15fd017ecbacf09e099338820

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#import-assertions

Currently, the import assertion is being lost (since node.assertClause is not taken into the consideration by typescript-transform-paths) and so you get the ERR_IMPORT_ASSERTION_TYPE_MISSING-like error if node >= 16.14 is used (previous versions don't force import assertion, like for importing json files with --experimental-json-modules arg).

nonara commented 1 year ago

Thanks for the report, @vladimiry ! I apologize for the delay. I've been pretty tied up this year.

I will add support and update this thread when it's ready!

vladimiry commented 1 year ago

A patch like this https://github.com/vladimiry/ElectronMail/blob/master/patches/typescript-transform-paths%403.3.1.patch resolves the issue for me (not sure if it handles all the cases).

nonara commented 1 year ago

Added in v3.4.0. Let me know if you still have any issues.