Skip to content

Commit d9fcbfd

Browse files
authored
Hotfix: Disable enhanced-resolve (#1506)
* Disable `enhanced-resolve` * Regenerate tests * Add changelog entries * Bump the version number
1 parent a810470 commit d9fcbfd

File tree

7 files changed

+43
-12
lines changed

7 files changed

+43
-12
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 9.4.1
4+
* [Hotfix: Disable `enhanced-resolve`](https://github.com/TypeStrong/ts-loader/pull/1505) - thanks @manuth
5+
36
## v9.4.0
47

58
* [Add Support for Resolving `.cjs`, `.mjs`, `.cts` and `.mts` Files](https://github.com/TypeStrong/ts-loader/pull/1503) [#1503] - thanks @manuth

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-loader",
3-
"version": "9.4.0",
3+
"version": "9.4.1",
44
"description": "TypeScript loader for webpack",
55
"main": "index.js",
66
"types": "dist",

src/resolver.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import type * as webpack from 'webpack';
22

3-
import { create } from 'enhanced-resolve';
3+
import { create as _create } from 'enhanced-resolve';
44

55
export function makeResolver(
6-
options: webpack.WebpackOptionsNormalized
6+
_options: webpack.WebpackOptionsNormalized
77
): ResolveSync {
8-
return create.sync(options.resolve);
8+
/* Currently, `enhanced-resolve` does not work properly alongside `ts-loader`.
9+
* This feature is disabled until a proper worflow has been worked out. */
10+
return (_context, _path, _moduleName?): string | false => {
11+
throw new Error();
12+
};
913
}
1014

1115
export type ResolveSync = {
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
asset bundle.js 2.6 KiB [emitted] (name: main)
2-
./app.ts 120 bytes [built] [code generated] [1 error]
2+
./app.ts 120 bytes [built] [code generated] [2 errors]
33
./common/components/myComponent.ts 46 bytes [built] [code generated]
44

5+
ERROR in app.ts
6+
./app.ts 1:29-53
7+
[tsl] ERROR in app.ts(1,30)
8+
 TS2307: Cannot find module 'components/myComponent' or its corresponding type declarations.
9+
ts-loader-default_609318b4f68865d3
10+
511
ERROR in app.ts
612
./app.ts 2:30-55
713
[tsl] ERROR in app.ts(2,31)
814
 TS2307: Cannot find module 'components/myComponent2' or its corresponding type declarations.
915
ts-loader-default_609318b4f68865d3
1016

11-
webpack compiled with 1 error
17+
webpack compiled with 2 errors
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
asset bundle.js 2.6 KiB [emitted] (name: main)
2-
./app.ts 120 bytes [built] [code generated] [1 error]
2+
cached modules 120 bytes [cached] 1 module
33
./common/components/myComponent.ts 45 bytes [built] [code generated]
44

5+
ERROR in app.ts
6+
./app.ts 1:29-53
7+
[tsl] ERROR in app.ts(1,30)
8+
 TS2307: Cannot find module 'components/myComponent' or its corresponding type declarations.
9+
ts-loader-default_609318b4f68865d3
10+
511
ERROR in app.ts
612
./app.ts 2:30-55
713
[tsl] ERROR in app.ts(2,31)
814
 TS2307: Cannot find module 'components/myComponent2' or its corresponding type declarations.
915
ts-loader-default_609318b4f68865d3
1016

11-
webpack compiled with 1 error
17+
webpack compiled with 2 errors
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
asset bundle.js 2.6 KiB [emitted] (name: main)
2-
./app.ts 120 bytes [built] [code generated] [1 error]
2+
./app.ts 120 bytes [built] [code generated] [2 errors]
33
./common/components/myComponent.ts 46 bytes [built] [code generated]
44

5+
ERROR in app.ts
6+
./app.ts 1:29-53
7+
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
8+
ts-loader-default_85b0565984bbe8dd
9+
510
ERROR in app.ts
611
./app.ts 2:30-55
712
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
813
ts-loader-default_85b0565984bbe8dd
914

10-
webpack compiled with 1 error
15+
webpack compiled with 2 errors
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
asset bundle.js 2.59 KiB [emitted] (name: main)
2-
./app.ts 101 bytes [built] [code generated]
2+
./app.ts 101 bytes [built] [code generated] [1 error]
33
./fake.ts 165 bytes [built] [code generated]
4-
webpack compiled successfully
4+
5+
ERROR in app.ts
6+
./app.ts 1:29-34
7+
[tsl] ERROR in app.ts(1,30)
8+
 TS2307: Cannot find module 'api' or its corresponding type declarations.
9+
ts-loader-default_609318b4f68865d3
10+
11+
webpack compiled with 1 error

0 commit comments

Comments
 (0)