Skip to content

Commit

Permalink
fix: places the alias inside the reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-vd authored Nov 7, 2021
1 parent 07b7f35 commit 83bf10c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ const getChunks = ({ namedChunkGroups }: WebStats): Chunks =>

return acc;
}, {} as Chunks);

const resolveAliases = (cwd: string, aliases: Record<string, string | string[]>): Record<string, string | string[]> => {
const alias = aliases[key];
const paths = Array.isArray(alias) ? alias.map(aliasPath => relative(cwd, aliasPath)) : relative(cwd, alias);
return Object.keys(aliases).reduce((acc, key) => ({ ...acc, [key]: paths }), {})
return Object.keys(aliases).reduce((acc, key) => {
const alias = aliases[key];
const paths = Array.isArray(alias) ? alias.map(aliasPath => relative(cwd, aliasPath)) : relative(cwd, alias);
return { ...acc, [key]: paths }
}, {})
};

export const importStats = (stats: WebStats, extraProps: Record<string, any> = {}): ImportedStat => {
Expand Down

0 comments on commit 83bf10c

Please sign in to comment.