microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.26k stars 128 forks source link

Work around runtime error when using esModuleInterop #64

Closed Shingyx closed 5 years ago

Shingyx commented 5 years ago

This is done by changing the __importDefault helper to import a module as-is only if the module has "default" defined.

This is a workaround for the error described in https://github.com/Microsoft/TypeScript/issues/27329. See https://github.com/Shingyx/esmoduleinterop-runtime-error for a sample project which demonstrates the runtime error.

msftclas commented 5 years ago

CLA assistant check
All CLA requirements met.

weswigham commented 5 years ago

We're not going to change the behavior of the builtin interop default import helper - it very intentionally matches the behavior of babel's default import helper.

Shingyx commented 5 years ago

I see. I opened this PR because I ran into the issue again recently and I didn't get feedback when I suggested this in the linked issue.

I'll close this PR. Cheers.