-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[p5.js 2.0] Investigate replacing dependencies #7761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another improvement would be to replace concurrently with npm-run-all2. The scripts would have to be changed a bit: // ...
"dev:build": "rollup -c -w",
"dev:serve": "vite preview/global/",
"dev:global": "run-p -l \"dev:build\" \"dev:serve\"",
// ... Concurrently relies on the packages 'chalk' and 'lodash' which are also quite heavy. Migrating to 'npm-run-all2' would save another 20 MB disk space. And one could go even further and write a small node script which utilises the vite and rollup APIs and spawns the build and serve scripts as child_processes. |
For the following dependencies
For node_module size, especially from dev dependencies optimizing for size isn't really a goal. If the desire is to preserve disk space, using |
Yes, honestly I didn't take a closer look at the implementation of color.js and it's capabilities in p5.js. Sorry for the hassle. You're right, using pnpm would be the right way. Unfortunately pnpm isn't used very often. Would it be an option to write the code to save image files? |
Do you mean for file-saver or omggif? I think for either there are some very new Web API standard that can possibly replace them eventually but at this point they are not widely implemented yet so they can't be used with p5.js until more widely available. |
One other thing to mention: @perminder-17 was looking into replacing libtess with earcut here #7492, which is on pause because other changes were higher priority, but we intend to get back to that. it's not exactly a 1:1 change so we're looking into balancing performance and feature set. We haven't yet looked into its bundle size as a consideration though. Our main space saving measure there was to allow 2D only users to not import WebGL at all, which should now be feasible as @perminder-17 also built a minimal filter runner for 2D mode. We haven't yet made an easily accessible (CDNed?) build like this, but that could be the lowest hanging fruit maybe? |
I closed the original PR because I edited the changes directly on my local Yes, regarding the dependecies Regarding the dev dependencies I totally agree that it's not the (current) primary goal and that there are better ways but I also want to raise awareness that it's a tiny step to conserve ressources and energy by replacing some packages. Additionally these changes would also affect performance. Specifically After all there's a whole community which tries to improve the js ecosystem: e18e. They also provide great ressources and tooling like publint and arethetypeswrong Regarding the easily accessible build I wonder if esm.sh would also be a viable option? But this should be a concern of p5.js-website/p5.js-editor |
|
Hey there,
First of all: congratulations and thank you for releasing 2.0
I've been looking through the dependencies in the package.json file and thought that it might be possible to reduce the weight of the node_modules folder and its contents (208 MB). Additionally this could result in a smaller bundle and speed up the build and tests. See the list down below for further insights
Another Issue that caught my eye is the 'exports' field
"./": "./src/app.js"
. The specifier"./"
should be changed to"."
dependency replacements
[email protected] (7.85 MB) => chroma.js (396 kB)
file-saver@^1.3.8 (36 kB)
[email protected]
[email protected] (38.5 kB)
dev dependency replacements
[email protected] (670 kB)
[email protected] (132 kB) => nano-staged (41.1 kB)
[email protected] (4.49 MB)
The text was updated successfully, but these errors were encountered: