Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const extractFiles = (chunkData, rawPublicPath) => {
const publicPath = trimTrailingSlash(rawPublicPath);
const { entryChunks, vendorChunks, chunksByModule } = chunkData;
const gatherFiles = (result, { files }) => [
...result,
...files.map((file) => `${publicPath}/${file}`),
];
return {
entryFiles: entryChunks.reduce(gatherFiles, []),
vendorFiles: vendorChunks.reduce(gatherFiles, []),
moduleFileMap: chunksByModule.reduce((result, [module, chunks]) => {
result[module] = chunks.reduce(gatherFiles, []);
return result;
}, {}),
};
};