From bc766796ff216d44bf63ff3f8cd362f5f75c9fce Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 20 Sep 2022 16:34:11 +0000 Subject: [PATCH 1/4] Disable `enhanced-resolve` --- src/resolver.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/resolver.ts b/src/resolver.ts index 9509f00f6..3f3df630d 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -1,11 +1,15 @@ import type * as webpack from 'webpack'; -import { create } from 'enhanced-resolve'; +import { create as _create } from 'enhanced-resolve'; export function makeResolver( - options: webpack.WebpackOptionsNormalized + _options: webpack.WebpackOptionsNormalized ): ResolveSync { - return create.sync(options.resolve); + /* Currently, `enhanced-resolve` does not work properly alongside `ts-loader`. + * This feature is disabled until a proper worflow has been worked out. */ + return (_context, _path, _moduleName?): string | false => { + throw new Error(); + }; } export type ResolveSync = { From 6e5e7e0b525876921f62e34c9e770c03ef2b03d7 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 20 Sep 2022 17:14:23 +0000 Subject: [PATCH 2/4] Regenerate tests --- .../aliasResolution/expectedOutput-4.8/output.txt | 10 ++++++++-- .../expectedOutput-4.8/patch0/output.txt | 10 ++++++++-- .../errorFormatter/expectedOutput-4.8/output.txt | 9 +++++++-- .../expectedOutput-4.8/output.txt | 11 +++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/test/comparison-tests/aliasResolution/expectedOutput-4.8/output.txt b/test/comparison-tests/aliasResolution/expectedOutput-4.8/output.txt index 61d336885..1258b61ed 100644 --- a/test/comparison-tests/aliasResolution/expectedOutput-4.8/output.txt +++ b/test/comparison-tests/aliasResolution/expectedOutput-4.8/output.txt @@ -1,11 +1,17 @@ asset bundle.js 2.6 KiB [emitted] (name: main) -./app.ts 120 bytes [built] [code generated] [1 error] +./app.ts 120 bytes [built] [code generated] [2 errors] ./common/components/myComponent.ts 46 bytes [built] [code generated] +ERROR in app.ts +./app.ts 1:29-53 +[tsl] ERROR in app.ts(1,30) + TS2307: Cannot find module 'components/myComponent' or its corresponding type declarations. +ts-loader-default_609318b4f68865d3 + ERROR in app.ts ./app.ts 2:30-55 [tsl] ERROR in app.ts(2,31)  TS2307: Cannot find module 'components/myComponent2' or its corresponding type declarations. ts-loader-default_609318b4f68865d3 -webpack compiled with 1 error \ No newline at end of file +webpack compiled with 2 errors \ No newline at end of file diff --git a/test/comparison-tests/aliasResolution/expectedOutput-4.8/patch0/output.txt b/test/comparison-tests/aliasResolution/expectedOutput-4.8/patch0/output.txt index 9ce404768..b9e20a7e7 100644 --- a/test/comparison-tests/aliasResolution/expectedOutput-4.8/patch0/output.txt +++ b/test/comparison-tests/aliasResolution/expectedOutput-4.8/patch0/output.txt @@ -1,11 +1,17 @@ asset bundle.js 2.6 KiB [emitted] (name: main) -./app.ts 120 bytes [built] [code generated] [1 error] +cached modules 120 bytes [cached] 1 module ./common/components/myComponent.ts 45 bytes [built] [code generated] +ERROR in app.ts +./app.ts 1:29-53 +[tsl] ERROR in app.ts(1,30) + TS2307: Cannot find module 'components/myComponent' or its corresponding type declarations. +ts-loader-default_609318b4f68865d3 + ERROR in app.ts ./app.ts 2:30-55 [tsl] ERROR in app.ts(2,31)  TS2307: Cannot find module 'components/myComponent2' or its corresponding type declarations. ts-loader-default_609318b4f68865d3 -webpack compiled with 1 error \ No newline at end of file +webpack compiled with 2 errors \ No newline at end of file diff --git a/test/comparison-tests/errorFormatter/expectedOutput-4.8/output.txt b/test/comparison-tests/errorFormatter/expectedOutput-4.8/output.txt index 28ee4f9d5..57bf27ad4 100644 --- a/test/comparison-tests/errorFormatter/expectedOutput-4.8/output.txt +++ b/test/comparison-tests/errorFormatter/expectedOutput-4.8/output.txt @@ -1,10 +1,15 @@ asset bundle.js 2.6 KiB [emitted] (name: main) -./app.ts 120 bytes [built] [code generated] [1 error] +./app.ts 120 bytes [built] [code generated] [2 errors] ./common/components/myComponent.ts 46 bytes [built] [code generated] +ERROR in app.ts +./app.ts 1:29-53 +Does not compute.... code: 2307,severity: error,content: Cannot find module 'components/myComponent' or its corresponding type declarations.,file: app.ts,line: 1,character: 30,context: .test/errorFormatter +ts-loader-default_85b0565984bbe8dd + ERROR in app.ts ./app.ts 2:30-55 Does not compute.... code: 2307,severity: error,content: Cannot find module 'components/myComponent2' or its corresponding type declarations.,file: app.ts,line: 2,character: 31,context: .test/errorFormatter ts-loader-default_85b0565984bbe8dd -webpack compiled with 1 error \ No newline at end of file +webpack compiled with 2 errors \ No newline at end of file diff --git a/test/comparison-tests/localTsImplementationOfTypings/expectedOutput-4.8/output.txt b/test/comparison-tests/localTsImplementationOfTypings/expectedOutput-4.8/output.txt index 99c0b622c..547ef058e 100644 --- a/test/comparison-tests/localTsImplementationOfTypings/expectedOutput-4.8/output.txt +++ b/test/comparison-tests/localTsImplementationOfTypings/expectedOutput-4.8/output.txt @@ -1,4 +1,11 @@ asset bundle.js 2.59 KiB [emitted] (name: main) -./app.ts 101 bytes [built] [code generated] +./app.ts 101 bytes [built] [code generated] [1 error] ./fake.ts 165 bytes [built] [code generated] -webpack compiled successfully \ No newline at end of file + +ERROR in app.ts +./app.ts 1:29-34 +[tsl] ERROR in app.ts(1,30) + TS2307: Cannot find module 'api' or its corresponding type declarations. +ts-loader-default_609318b4f68865d3 + +webpack compiled with 1 error \ No newline at end of file From 4e87fd795c9660eacbaa684a37b00edb5dbd1c29 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 20 Sep 2022 17:21:18 +0000 Subject: [PATCH 3/4] Add changelog entries --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd777cf4..91d42fcb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 9.4.1 +* [Hotfix: Disable `enhanced-resolve`](https://github.com/TypeStrong/ts-loader/pull/1505) - thanks @manuth + ## v9.4.0 * [Add Support for Resolving `.cjs`, `.mjs`, `.cts` and `.mts` Files](https://github.com/TypeStrong/ts-loader/pull/1503) [#1503] - thanks @manuth From 35c4a44c5554f754461ddf581ecfaa0d20123779 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 20 Sep 2022 17:21:54 +0000 Subject: [PATCH 4/4] Bump the version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 60b942f5f..40487d987 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "9.4.0", + "version": "9.4.1", "description": "TypeScript loader for webpack", "main": "index.js", "types": "dist",