Skip to content

Respect importModuleSpecifierEnding inside node_modules packages#48995

Merged
andrewbranch merged 2 commits intomicrosoft:mainfrom
andrewbranch:bug/48991
May 6, 2022
Merged

Respect importModuleSpecifierEnding inside node_modules packages#48995
andrewbranch merged 2 commits intomicrosoft:mainfrom
andrewbranch:bug/48991

Conversation

@andrewbranch
Copy link
Copy Markdown
Member

Fixes #48991

@andrewbranch andrewbranch requested a review from weswigham May 6, 2022 17:48
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels May 6, 2022
Comment thread src/compiler/moduleSpecifiers.ts
@andrewbranch andrewbranch requested a review from sheetalkamat May 6, 2022 17:52
// @Filename: /a.ts
//// customElement/**/

verify.importFixModuleSpecifiers("", ["lit/decorators.js"], { importModuleSpecifierEnding: "js" })
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a test for .cjs/.mjs as well, since you mentioned that they were broken before?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, are there already tests for filename/package conflicts? I assume yes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are .cjs tests. Filename/package conflicts aren’t related to this change, I think.

}

function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCanonicalFileName, sourceDirectory }: Info, importingSourceFile: SourceFile , host: ModuleSpecifierResolutionHost, options: CompilerOptions, packageNameOnly?: boolean, overrideMode?: ModuleKind.ESNext | ModuleKind.CommonJS): string | undefined {
function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCanonicalFileName, sourceDirectory }: Info, importingSourceFile: SourceFile , host: ModuleSpecifierResolutionHost, options: CompilerOptions, userPreferences: UserPreferences, packageNameOnly?: boolean, overrideMode?: ModuleKind.ESNext | ModuleKind.CommonJS): string | undefined {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is comically long

@andrewbranch andrewbranch merged commit 2ffe686 into microsoft:main May 6, 2022
@andrewbranch andrewbranch deleted the bug/48991 branch May 6, 2022 19:58
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"importModuleSpecifierEnding" : "js" has no effect on import fixes from inside node_modules

5 participants