Open thisconnect opened 5 years ago
I've got these kinds of functions and it tree shaking seems to stop the callbacks from working. Open to suggestions.
const createFoo = () => {
return {
onsomething: () => {}
}
}
// some time later
const foo = createFoo();
foo.onsomething = () => {
// logic
}
I noticed with treeshaking, that the click bubble animation (like material design) didn't get triggered. Not sure if this is related.
BTW. I don't think you should have to change the code, but rollup should either error or build it.. So I think if you could pin point the issue, I'd suggest to open a rollup issue with it.
Alright, I'll test it later this week or at the start of the next
@thisconnect I ran some more tests.
The ondragend
handler will be set by another function. When treeshaking is enabled, Rollup will remove api.ondragend(position)
, this will cause FilePond to stop working.
Feel free to open an issue on the Rollup repo (if this is not configurable or I'm missing some configuration thing), unfortunately I'm currently too busy to look into this further.
I just got bitten by that this library needs treeshake disabled https://github.com/pqina/filepond/blob/bbaf944178a8c6a0802f5a0106fb308fbf6269fb/rollup.scripts.js#L41
Rollup seems to treeshake too much away, is this a rollup bug?
The commit where treeshaking was disabled is in https://github.com/pqina/filepond/commit/33878b5cb1269a428259a2399207ed63bc0ccdd6#diff-527d3af57329b4d70ddb9b2ee335f0cb
But it is unclear which code is affected, commit messages mentions "disable tree shaking as it removes placeholder functions"
Summary
Could you provide more details on why treeshaking needs to be disabled?
Consider opening a rollup issue.
How to reproduce
rollup a bundle that imports filepond
Expected behaviour
the bundle should work, i.e. the example code
Additional information
rollup@1.21.4