Skip to content

Commit

Permalink
fix(HMR): Support render assets as array of files from HMR
Browse files Browse the repository at this point in the history
Support assets as array of files that typically comes from Hot Module Reloading.
  • Loading branch information
jahredhope authored Nov 27, 2019
1 parent 203a21b commit faafb06
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ export = class HtmlRenderPlugin<Route extends BaseRoute = BaseRoute> {
);
}

const renderFile = typeof asset === "string" ? asset : asset.name;
return renderFile.toString();
let renderFile: any = asset;
if (Array.isArray(renderFile)) {
renderFile = renderFile[0];
}
if (renderFile && typeof renderFile === "object") {
renderFile = renderFile.name;
}

return renderFile as string;
};

const renderCallbacks: any[] = [];
Expand Down

0 comments on commit faafb06

Please sign in to comment.