Closed quinton-ashley closed 11 months ago
For mobile app development that's a problem
Could you please elaborate on what the problem is? My understanding is that your build and distribution files would just include the files that you use, rather than the entire npm package.
The files that are taking space are sourcemap files. I guess sourcemaps for unminified files might be unnecessary, we can consider removing them (it will reduce around 12mb). We will drop some of build formats in next major release.
npm packages typically don't include 0.6MB of source files and other distributed files for alternate versions of a project all in one package.
Some packages include source, some don't. Usually multi-package mono-repo projects (for example React) don't include source in each package, because it doesn't make sense. Otherwise it's a common practice to include almost entire repo with source, docs, different build formats, sourcemap, etc.
I actually don't think I've ever seen an npm package include anything extra besides dist, types, and sometimes typescript source. But I could be wrong.
React is a bad example because people complain about it's size too. 😅 Try looking at just normal JavaScript libraries, not frameworks.
You shouldn't put the burden on users to exclude files from their build when you could just exclude them from the npm package to start. Just my opinion, but I think you could make planck with the testbed a separate package on npm too.
But yeah just removing the minified source maps would be great! Then the package would only be 6.5MB which is way better.
Please don't remove the source maps. 18MB is nothing. It's not like it gets added to your project bundle size. It's just a one off install cost that's downloaded in seconds.
It's a nice convenience to have ready prepared, and not have to mess around wasting time generating them, all for the sake of a tiny fraction of a percent of drive space.
Either way, 6.5MB is still too big imo. I'm just going to keep including planck.min.js (209kb) in p5play's npm package.
So maybe listen to @photonstorm instead!
Be thankful you don't have to include the three.js repo :)
@photonstorm I have same opinion as you about dev-experience vs npm package size. I just wonder if source-map for "unminified" files is useful? (For minified files, source-map is definitely critical.)
@photonstorm I have same opinion as you about dev-experience vs npm package size. I just wonder if source-map for "unminified" files is useful? (For minified files, source-map is definitely critical.)
Hmmm for me personally I'd say they are more useful during development (so unminified). That is when you want to save the most time debugging, so accurate function names and line numbers are great. Once I hit prod (minified) it's far less important.
Planck is a bit of an edge case in that lots of devs will just import it into their games, so they can generate the maps are part of their build process and don't need them in npm. But those who want to do quick script-tag type testing would need them!
Thanks for letting me know, since they are being used it makes sense to keep them.
Btw great work on v1 beta16! 🎊
I wouldn't say this is a REAL issue but the planck npm package is quite large: 18.5 MB. For mobile app development that's a problem, so they wouldn't use planck via npm if they only need dist/planck.js or dist/planck.min.js
npm packages typically don't include 0.6MB of source files and other distributed files for alternate versions of a project all in one package.
I don't know how to do this personally but I've seen other projects that have source files just in their github repo and then they only include the types folder and basic dist files in their npm package. So it's definitely possible!