This works without minification.
export function distributionBy(options: DistributionOptions): LayoutFunction {
const {dimension} = options;
return layout(
({
nodes,
initial,
channels: {
initial: {
[dimension]: { domain },
},
},
}): LayoutResult => {
const { bin, dimension, reverse, spread } = options;
Here is the minified code
function Jh(e){const{dimension:t}=e;return fd((({nodes:t,initial:n,channels:{initial:{[a]:{domain:r}}}})=>{const{bin:i,dimension:a,reverse:s,spread:u}=e
Note that the inner-most "dimension" variable is renamed to "a", which is referenced in fd's parameter destructuring. When the minified code runs, [a] resolves to [undefined] which isn't what I want at all. I think it should be [t], defined in the top most scope (inside Jh).
Can any Webpack pros offer some insight?
My workaround is to do [options.dimension], which resolves correctly.