mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix self reference package with casing
This commit is contained in:
@@ -2249,7 +2249,7 @@ namespace ts {
|
||||
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
||||
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
||||
&& finalPath.indexOf("/node_modules/") === -1
|
||||
&& (state.compilerOptions.configFile ? startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)
|
||||
&& (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)
|
||||
) {
|
||||
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
||||
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
||||
@@ -2310,7 +2310,7 @@ namespace ts {
|
||||
for (const commonSourceDirGuess of commonSourceDirGuesses) {
|
||||
const candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
||||
for (const candidateDir of candidateDirectories) {
|
||||
if (startsWith(finalPath, candidateDir)) {
|
||||
if (containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
|
||||
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
||||
const pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
||||
const possibleInputBase = combinePaths(commonSourceDirGuess, pathFragment);
|
||||
|
||||
+4
-13
@@ -35,28 +35,19 @@ Found 'package.json' at '/users/name/projects/web/package.json'.
|
||||
======== Resolving module '@this/package' from '/Users/name/projects/web/index.ts'. ========
|
||||
Module resolution kind is not specified, using 'NodeNext'.
|
||||
File '/users/name/projects/web/package.json' exists according to earlier cached lookups.
|
||||
File '/users/name/projects/web/index.ts' exist - use it as a name resolution result.
|
||||
Resolving real path for '/users/name/projects/web/index.ts', result '/Users/name/projects/web/index.ts'.
|
||||
======== Module name '@this/package' was successfully resolved to '/users/name/projects/web/index.ts'. ========
|
||||
File '/Users/name/projects/web/index.ts' exist - use it as a name resolution result.
|
||||
Resolving real path for '/Users/name/projects/web/index.ts', result '/Users/name/projects/web/index.ts'.
|
||||
======== Module name '@this/package' was successfully resolved to '/Users/name/projects/web/index.ts'. ========
|
||||
File '/a/lib/package.json' does not exist.
|
||||
File '/a/package.json' does not exist.
|
||||
File '/package.json' does not exist.
|
||||
[96mindex.ts[0m:[93m1[0m:[93m21[0m - [91merror[0m[90m TS1149: [0mFile name '/users/name/projects/web/index.ts' differs from already included file name '/Users/name/projects/web/index.ts' only in casing.
|
||||
The file is in the program because:
|
||||
Matched by default include pattern '**/*'
|
||||
Imported via "@this/package" from file '/Users/name/projects/web/index.ts'
|
||||
File is ECMAScript module because '/users/name/projects/web/package.json' has field "type" with value "module"
|
||||
|
||||
[7m1[0m import * as me from "@this/package";
|
||||
[7m [0m [91m ~~~~~~~~~~~~~~~[0m
|
||||
|
||||
../../../../a/lib/lib.esnext.full.d.ts
|
||||
Default library for target 'esnext'
|
||||
index.ts
|
||||
Matched by default include pattern '**/*'
|
||||
Imported via "@this/package" from file 'index.ts'
|
||||
File is ECMAScript module because 'package.json' has field "type" with value "module"
|
||||
[[90m12:00:36 AM[0m] Found 1 error. Watching for file changes.
|
||||
[[90m12:00:36 AM[0m] Found 0 errors. Watching for file changes.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user