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

Hotfix: Disable enhanced-resolve #1506

Merged
merged 4 commits into from Sep 20, 2022
Merged
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
3 changes: 3 additions & 0 deletions 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
Expand Down
2 changes: 1 addition & 1 deletion 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",
Expand Down
10 changes: 7 additions & 3 deletions 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 = {
Expand Down
@@ -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
@@ -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
@@ -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
@@ -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