shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.44k stars 184 forks source link

Add reduce, initValue, map, filter options #55

Closed mastilver closed 7 years ago

mastilver commented 7 years ago

fix: #48

filter: ({chunk, file}) => {
  return chunk.isInitial();
}

fix: #25

initValue: {

} // will be used as the initValue for reduce, default to `{}`

fix #35

map: ({chunk, file}) => {
  return {
    file,
    hash: chunk.source.integrity
  };
}
reduce: (manifest, {chunk, file}) => {
  return manifest;
}

map and reduce can't be used at the same time

nathanbirrell commented 7 years ago

Hey @mastilver I've added the initValue on my fork. Created PR https://github.com/danethurber/webpack-manifest-plugin/pull/57

I've added this because I needed to use custom manifest keys, but maybe that's not the intention on #25?

mastilver commented 7 years ago

@a-x- @zuzusik @gmac Once unit tests are close to 💯 I would like to start working on that

Is that something we want? Thoughts?

weaverryan commented 7 years ago

Just dropping a note that this would also solve #37, where we want to be able to tweak (prefix) both the keys and values of the manifest. This would be a much more flexible way of handling it than the one-off option I proposed there.

a-x- commented 7 years ago

initValue name is too abstract as I see.