muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
340 stars 46 forks source link

Change `createUpload` export #115

Closed mmvsk closed 1 year ago

mmvsk commented 1 year ago

Fixes #111 by replacing the exported constant function expression createUpload with a real function export.

This is an issue when compiling specific code with ESBuild (with minification), then bundling it with Webpack: https://github.com/mmvsk/bug-esbuild-min-webpack

The specific code is when there is a class with static methods that depend on previous variables (here the list of status codes), and when the static method is exported a function expression. Removing minification solves the issue, so it's very probably a problem inside ESBuild.

This fixes the problem for UpChunk.

cjpillsbury commented 1 year ago

Nice find, @mmvsk!

Removing minification solves the issue, so it's very probably a problem inside ESBuild.

Sounds plausible and would def be good for us to dig deeper into that (since we use esbuild a lot for our projects).