Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Type References (TypeScript 4.7) for webpack 4 #1445

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -96,7 +96,7 @@
"mocha": "^6.0.0",
"prettier": "^2.0.5",
"rimraf": "^2.6.2",
"typescript": "^4.0.0",
"typescript": "^4.6.3",
"webpack": "^4.5.0",
"webpack-cli": "^3.1.1"
},
Expand Down
4 changes: 3 additions & 1 deletion src/instances.ts
Expand Up @@ -380,7 +380,9 @@ export function initializeInstance(
customerTransformers = require(customerTransformers);
} catch (err) {
throw new Error(
`Failed to load customTransformers from "${instance.loaderOptions.getCustomTransformers}": ${err.message}`
`Failed to load customTransformers from "${
instance.loaderOptions.getCustomTransformers
}": ${err instanceof Error ? err.message : ''}`
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/interfaces.ts
Expand Up @@ -198,6 +198,7 @@ interface PerModuleNameCache {
result: typescript.ResolvedModuleWithFailedLookupLocations
): void;
}

export interface ModuleResolutionCache
extends typescript.ModuleResolutionCache {
directoryToModuleNameMap: CacheWithRedirects<
Expand All @@ -206,8 +207,8 @@ export interface ModuleResolutionCache
moduleNameToDirectoryMap: CacheWithRedirects<PerModuleNameCache>;
clear(): void;
update(compilerOptions: typescript.CompilerOptions): void;
getPackageJsonInfoCache?(): any;
}

// Until the API has been released and ts-loader is built against a version of TypeScript that contains it - see https://github.com/microsoft/TypeScript/blob/74993a2a64bb2e423b40204bb54ff749cdd4ef54/src/compiler/moduleNameResolver.ts#L458
export interface TypeReferenceDirectiveResolutionCache {
getOrCreateCacheForDirectory(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -6267,10 +6267,10 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^4.0.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e9"
integrity sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==
typescript@^4.6.3:
version "4.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c"
integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==

uglify-js@3.3.x:
version "3.3.9"
Expand Down