Skip to content

Commit

Permalink
Hotfix: Disable enhanced-resolve (#1506)
Browse files Browse the repository at this point in the history
* Disable `enhanced-resolve`

* Regenerate tests

* Add changelog entries

* Bump the version number
  • Loading branch information
manuth authored Sep 20, 2022
1 parent a810470 commit d9fcbfd
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 7 additions & 3 deletions src/resolver.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
webpack compiled with 2 errors
Original file line number Diff line number Diff line change
@@ -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
webpack compiled with 2 errors
Original file line number Diff line number Diff line change
@@ -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
webpack compiled with 2 errors
Original file line number Diff line number Diff line change
@@ -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

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

0 comments on commit d9fcbfd

Please sign in to comment.