123456789101112131415161718 |
- const isRequired = require('./isRequired.js');
- /**
- * Finds all chunks of a webpack compilation object and maps the chunk name
- * to the first containing file.
- *
- * @param {Object} compilation - a webpack compilation object
- * @param {Object[]} compilation.chunks - an array of webpack chunks
- * @return {Object}
- */
- function getChunkFiles (compilation = isRequired('compilation')) {
- return compilation.chunks.reduce(function mapChunksToFiles(files, chunk) {
- files[chunk.name] = chunk.files;
- return files;
- }, {});
- }
- module.exports = getChunkFiles;
|