Skip to content

Don’t use 'import =' for auto-import when esModuleInterop is on unless it’s already been done - #36475

Merged
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:masterfrom
andrewbranch:bug/29038
Jan 28, 2020
Merged

Andrew Branch (andrewbranch) merged 3 commits into
microsoft:masterfrom
andrewbranch:bug/29038

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Fixes #29038 more/again. I guess the original behavior was an intentional decision, but it was counter to what I remembered enough that I thought it was a bug.

Before: If import = and a default import both work (because esModuleInterop is on, and your module target is < ES2015), we would prefer import = unless imports in the same file were already taking advantage of esModuleInterop (by default importing a CommonJS export).

After: Reverse that logic. If esModuleInterop is on, we’ll prefer a default import unless there’s already one or more import = in the file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

3 participants