Skip to content

Commit

Permalink
don't overload ModuleRequest#alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Feb 13, 2023
1 parent aacd1a1 commit 237fa4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/module-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface ModuleRequest {
specifier: string;
fromFile: string;
isVirtual: boolean;
alias(newSpecifier: string, newFromFile?: string): this;
alias(newSpecifier: string): this;
rehome(newFromFile: string): this;
virtualize(virtualFilename: string): this;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ export class Resolver {
return request.rehome(resolve(pkg.root, 'package.json'));
} else {
// otherwise we need to just assume that internal naming is simple
return request.alias(request.specifier.replace(pkg.name, '.'), resolve(pkg.root, 'package.json'));
return request.alias(request.specifier.replace(pkg.name, '.')).rehome(resolve(pkg.root, 'package.json'));
}
}

Expand Down
6 changes: 1 addition & 5 deletions packages/webpack/src/webpack-resolver-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,8 @@ class WebpackModuleRequest implements ModuleRequest {
this.fromFile = state.contextInfo.issuer;
}

alias(newSpecifier: string, newFromFile?: string) {
alias(newSpecifier: string) {
this.state.request = newSpecifier;
if (newFromFile) {
this.state.contextInfo.issuer = newFromFile;
this.state.context = dirname(newFromFile);
}
return new WebpackModuleRequest(this.state) as this;
}
rehome(newFromFile: string) {
Expand Down

0 comments on commit 237fa4b

Please sign in to comment.