Skip to content

TsconfigPathsPlugin is asynchronous only #571

@doubleaxe

Description

@doubleaxe

Have you used AI?

No

Bug Description

While other plugins support synchronous execution, TsconfigPathsPlugin is asynchronous only.

Link to Minimal Reproduction and step to reproduce

Minimal example:

import * as fs from 'node:fs';

import enhancedResolve from 'enhanced-resolve';

const resolver = enhancedResolve.ResolverFactory.createResolver({
    aliasFields: [],
    conditionNames: [],
    descriptionFiles: [],
    exportsFields: [],
    extensionAliasForExports: false,
    fallback: [],
    fileSystem: fs,
    fullySpecified: false,
    importsFields: [],
    mainFields: [],
    mainFiles: [],
    modules: [],
    plugins: [],
    preferAbsolute: false,
    preferRelative: false,
    resolveToContext: false,
    restrictions: [],
    roots: [],
    symlinks: false,
    tsconfig: true,
    useSyncFileSystemCalls: true,
});
resolver.resolveSync('.', 'test');

Expected Behavior

It should at least show Can't resolve 'test' in '.'

Actual Behavior

It throws confusing message, when I try to use it:

Cannot 'resolveSync' because the fileSystem is not sync. Use 'resolve'!

If tsconfig: true is commented - everything works in synchronous mode.

Environment

System:
    OS: Linux 6.6 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 13.77 GB / 23.42 GB
  Binaries:
    Node: 22.22.0 - /run/user/1000/fnm_multishells/186880_1778173609680/bin/node
    npm: 10.9.4 - /run/user/1000/fnm_multishells/186880_1778173609680/bin/npm
    pnpm: 9.15.9 - /run/user/1000/fnm_multishells/186880_1778173609680/bin/pnpm

Is this a regression?

No

Last Working Version

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions