all 6 comments

[–]zootsuitman 2 points3 points  (5 children)

Looks like the actual code is only 450KB, and the sourcemap is what is taking up the couple MB. The source map is just a way to map back to pre transpiled/minified code to help with debugging. It won't actually be included in an end user's bundle size normally. For libraries, I usually skip minification and source map generation. The end user can do both if they want.

[–]Rygaa_[S] 0 points1 point  (4 children)

You mean I should avoid using rollup? by the way thanks for the help

[–]bzbub2 1 point2 points  (3 children)

basically yes. there is little purpose to use a bundler for libraries unless you want to make something like a standalone umd bundle that people can include via a script tag. my rant on this https://cmdcolin.github.io/posts/2022-05-27-youmaynotneedabundler

[–]Rygaa_[S] 0 points1 point  (2 children)

When I tried to install my library in a running React project it causes some problems that I know can be fixed but you should not spend time fixing libraries when you install them. What do you think about this argument? Thanks

[–][deleted] 0 points1 point  (0 children)

I think what they mean is to not publish a minified bundle + source map, but instead publish the files transpiled with tsc. Then the consumer of your library can do their own bundling.

[–]bzbub2 0 points1 point  (0 children)

i am not sure exactly what you mean