Skip to content

Commit

Permalink
fix webpack loader types and virtual loader content
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Feb 1, 2024
1 parent 11b43c0 commit fa9338a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/hbs-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Options {
};
}

export default function hbsLoader(this: LoaderContext<Options>, templateContent: string) {
export default function hbsLoader(this: LoaderContext<Options>, templateContent: string): string | undefined {
let { compatModuleNaming } = this.getOptions();
try {
return hbsToJS(templateContent, { filename: this.resourcePath, compatModuleNaming });
Expand Down
4 changes: 2 additions & 2 deletions packages/webpack/src/virtual-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function setup(appRoot: string): ResolverLoader {
return resolverLoader;
}

export default function virtualLoader(this: LoaderContext<unknown>) {
export default function virtualLoader(this: LoaderContext<unknown>): string | undefined {
if (typeof this.query === 'string' && this.query[0] === '?') {
let params = new URLSearchParams(this.query);
let filename = params.get('f');
Expand All @@ -20,7 +20,7 @@ export default function virtualLoader(this: LoaderContext<unknown>) {
}
let { resolver } = setup(appRoot);
this.resourcePath = filename;
return virtualContent(filename, resolver);
return virtualContent(filename, resolver).src;
}
throw new Error(`@embroider/webpack/src/virtual-loader received unexpected request: ${this.query}`);
}

0 comments on commit fa9338a

Please sign in to comment.