Skip to content

Incorrect Resolve tsconfig path aliases in ESM mode have failed on 3.5.4 #4194

@tianyingchun

Description

@tianyingchun

after upgrade vendure "@vendure/dashboard": "^3.5.3", it can not build dashboard success on ESM mode

the function resolvePathAlias(moduleSpecifier, pathMatchers) { also return fixed path from pathMatchers

for example

Image Image

the second facet-value-help.service.js is child level in folder services, but it resolvePathAlias() also return a fixed relative path

function resolvePathAlias(moduleSpecifier, pathMatchers) {
    if (moduleSpecifier.startsWith('.') || moduleSpecifier.startsWith('/')) {
        return undefined;
    }
    for (const { regex, targets, hasWildcard } of pathMatchers) {
        const match = regex.exec(moduleSpecifier);
        if (match) {
            const target = targets[0];
            const resolved = hasWildcard && match[1] ? target.split('*').join(match[1]) : target;
            return normalizeResolvedPath(resolved);
        }
    }
    return undefined;
}

The path alias needs to incorporate the current code file facet-value-help.service.js with the paths configuration and pass it to resolvePathAlias for calculating a correct relative import path.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions