-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
combineModules (custom build) output is not minified #3950
Comments
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already. |
I should note that my build can't be merged as-is right now, it breaks things overall… was testing a quick workaround. Will update with something which can be merged. |
Okay, I've pushed an update (0de9bc4) which seems to do the trick without breaking anything (as far as I can tell). If there's a better way to improve the Grunt tasks enabling "uglified browseified minified" output 😉 for custom builds please let me know. I'm not familiar enough with Grunt or the p5.js build system so might be missing something obvious. Truncated output from `npm run grunt` after initial `npm i`
$ npm run grunt
> [email protected] grunt /Users/corey/Projects/p5.js
> grunt
...
Running "browserify" task
>> Bundle lib/p5.js created.
Running "browserify:min" (browserify) task
>> Bundle lib/p5.pre-min.js created.
Running "uglify:dist" (uglify) task
>> Destination lib/modules/p5Custom.min.js not written because src files were empty.
>> 1 files created 2.99 MB → 554.57 kB
...
Done. `npm run grunt combineModules:core/shape:color:math:image`
$ npm run grunt combineModules:core/shape:color:math:image
> [email protected] grunt /Users/corey/Projects/p5.js
> grunt "combineModules:core/shape:color:math:image"
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Running "combineModules:core/shape:color:math:image" (combineModules) task
[ '/Users/corey/Projects/p5.js/src/core/main.js',
'/Users/corey/Projects/p5.js/src/core/constants.js',
'/Users/corey/Projects/p5.js/src/core/environment.js',
'/Users/corey/Projects/p5.js/src/core/error_helpers.js',
'/Users/corey/Projects/p5.js/src/core/helpers.js',
'/Users/corey/Projects/p5.js/src/core/legacy.js',
'/Users/corey/Projects/p5.js/src/core/preload.js',
'/Users/corey/Projects/p5.js/src/core/p5.Element.js',
'/Users/corey/Projects/p5.js/src/core/p5.Graphics.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer2D.js',
'/Users/corey/Projects/p5.js/src/core/rendering.js',
'/Users/corey/Projects/p5.js/src/core/shim.js',
'/Users/corey/Projects/p5.js/src/core/structure.js',
'/Users/corey/Projects/p5.js/src/core/transform.js',
'/Users/corey/Projects/p5.js/src/core/shape/2d_primitives.js',
'/Users/corey/Projects/p5.js/src/core/shape/attributes.js',
'/Users/corey/Projects/p5.js/src/core/shape/curves.js',
'/Users/corey/Projects/p5.js/src/core/shape/vertex.js',
'/Users/corey/Projects/p5.js/src/color/color_conversion.js',
'/Users/corey/Projects/p5.js/src/color/creating_reading.js',
'/Users/corey/Projects/p5.js/src/color/p5.Color.js',
'/Users/corey/Projects/p5.js/src/color/setting.js',
'/Users/corey/Projects/p5.js/src/image/filters.js',
'/Users/corey/Projects/p5.js/src/image/image.js',
'/Users/corey/Projects/p5.js/src/image/loading_displaying.js',
'/Users/corey/Projects/p5.js/src/image/p5.Image.js',
'/Users/corey/Projects/p5.js/src/image/pixels.js',
'/Users/corey/Projects/p5.js/src/math/calculation.js',
'/Users/corey/Projects/p5.js/src/math/math.js',
'/Users/corey/Projects/p5.js/src/math/noise.js',
'/Users/corey/Projects/p5.js/src/math/p5.Vector.js',
'/Users/corey/Projects/p5.js/src/math/random.js',
'/Users/corey/Projects/p5.js/src/math/trigonometry.js',
'/Users/corey/Projects/p5.js/src/core/init.js' ]
>> Module /Users/corey/Projects/p5.js/lib/modules/p5Custom.js created.
Done. `npm run grunt uglify` prior to `npm run grunt combineModules:min`
$ npm run grunt uglify
> [email protected] grunt /Users/corey/Projects/p5.js
> grunt "uglify"
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Running "uglify:dist" (uglify) task
>> Destination lib/modules/p5Custom.min.js not written because src files were empty.
>> 1 files created 2.99 MB → 554.57 kB
Done. `npm run grunt combineModules:min:core/shape:color:math:image uglify`
$ npm run grunt combineModules:min:core/shape:color:math:image uglify
> [email protected] grunt /Users/corey/Projects/p5.js
> grunt "combineModules:min:core/shape:color:math:image" "uglify"
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Running "combineModules:min:core/shape:color:math:image" (combineModules) task
[ '/Users/corey/Projects/p5.js/src/core/main.js',
'/Users/corey/Projects/p5.js/src/core/constants.js',
'/Users/corey/Projects/p5.js/src/core/environment.js',
'/Users/corey/Projects/p5.js/src/core/error_helpers.js',
'/Users/corey/Projects/p5.js/src/core/helpers.js',
'/Users/corey/Projects/p5.js/src/core/legacy.js',
'/Users/corey/Projects/p5.js/src/core/preload.js',
'/Users/corey/Projects/p5.js/src/core/p5.Element.js',
'/Users/corey/Projects/p5.js/src/core/p5.Graphics.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer2D.js',
'/Users/corey/Projects/p5.js/src/core/rendering.js',
'/Users/corey/Projects/p5.js/src/core/shim.js',
'/Users/corey/Projects/p5.js/src/core/structure.js',
'/Users/corey/Projects/p5.js/src/core/transform.js',
'/Users/corey/Projects/p5.js/src/core/shape/2d_primitives.js',
'/Users/corey/Projects/p5.js/src/core/shape/attributes.js',
'/Users/corey/Projects/p5.js/src/core/shape/curves.js',
'/Users/corey/Projects/p5.js/src/core/shape/vertex.js',
'/Users/corey/Projects/p5.js/src/color/color_conversion.js',
'/Users/corey/Projects/p5.js/src/color/creating_reading.js',
'/Users/corey/Projects/p5.js/src/color/p5.Color.js',
'/Users/corey/Projects/p5.js/src/color/setting.js',
'/Users/corey/Projects/p5.js/src/image/filters.js',
'/Users/corey/Projects/p5.js/src/image/image.js',
'/Users/corey/Projects/p5.js/src/image/loading_displaying.js',
'/Users/corey/Projects/p5.js/src/image/p5.Image.js',
'/Users/corey/Projects/p5.js/src/image/pixels.js',
'/Users/corey/Projects/p5.js/src/math/calculation.js',
'/Users/corey/Projects/p5.js/src/math/math.js',
'/Users/corey/Projects/p5.js/src/math/noise.js',
'/Users/corey/Projects/p5.js/src/math/p5.Vector.js',
'/Users/corey/Projects/p5.js/src/math/random.js',
'/Users/corey/Projects/p5.js/src/math/trigonometry.js',
'/Users/corey/Projects/p5.js/src/core/init.js' ]
>> Module /Users/corey/Projects/p5.js/lib/modules/p5Custom.pre-min.js created.
Running "uglify:dist" (uglify) task
>> 2 files created 4.36 MB → 766.25 kB
Done. Note: Clean previous build output then `npm run grunt combineModules:min:... uglify`
$ rm -rf p5.min.js p5.pre-min.js p5.js p5-test.js modules/*
$ npm run grunt combineModules:min:core/shape:color:math:image uglify
> [email protected] grunt /Users/corey/Projects/p5.js
> grunt "combineModules:min:core/shape:color:math:image" "uglify"
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Running "combineModules:min:core/shape:color:math:image" (combineModules) task
[ '/Users/corey/Projects/p5.js/src/core/main.js',
'/Users/corey/Projects/p5.js/src/core/constants.js',
'/Users/corey/Projects/p5.js/src/core/environment.js',
'/Users/corey/Projects/p5.js/src/core/error_helpers.js',
'/Users/corey/Projects/p5.js/src/core/helpers.js',
'/Users/corey/Projects/p5.js/src/core/legacy.js',
'/Users/corey/Projects/p5.js/src/core/preload.js',
'/Users/corey/Projects/p5.js/src/core/p5.Element.js',
'/Users/corey/Projects/p5.js/src/core/p5.Graphics.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer.js',
'/Users/corey/Projects/p5.js/src/core/p5.Renderer2D.js',
'/Users/corey/Projects/p5.js/src/core/rendering.js',
'/Users/corey/Projects/p5.js/src/core/shim.js',
'/Users/corey/Projects/p5.js/src/core/structure.js',
'/Users/corey/Projects/p5.js/src/core/transform.js',
'/Users/corey/Projects/p5.js/src/core/shape/2d_primitives.js',
'/Users/corey/Projects/p5.js/src/core/shape/attributes.js',
'/Users/corey/Projects/p5.js/src/core/shape/curves.js',
'/Users/corey/Projects/p5.js/src/core/shape/vertex.js',
'/Users/corey/Projects/p5.js/src/color/color_conversion.js',
'/Users/corey/Projects/p5.js/src/color/creating_reading.js',
'/Users/corey/Projects/p5.js/src/color/p5.Color.js',
'/Users/corey/Projects/p5.js/src/color/setting.js',
'/Users/corey/Projects/p5.js/src/image/filters.js',
'/Users/corey/Projects/p5.js/src/image/image.js',
'/Users/corey/Projects/p5.js/src/image/loading_displaying.js',
'/Users/corey/Projects/p5.js/src/image/p5.Image.js',
'/Users/corey/Projects/p5.js/src/image/pixels.js',
'/Users/corey/Projects/p5.js/src/math/calculation.js',
'/Users/corey/Projects/p5.js/src/math/math.js',
'/Users/corey/Projects/p5.js/src/math/noise.js',
'/Users/corey/Projects/p5.js/src/math/p5.Vector.js',
'/Users/corey/Projects/p5.js/src/math/random.js',
'/Users/corey/Projects/p5.js/src/math/trigonometry.js',
'/Users/corey/Projects/p5.js/src/core/init.js' ]
>> Module /Users/corey/Projects/p5.js/lib/modules/p5Custom.pre-min.js created.
Running "uglify:dist" (uglify) task
>> Destination lib/p5.min.js not written because src files were empty.
>> 1 files created 1.37 MB → 211.68 kB
Done. Check output size from direct uglifyjs p5Custom.js run
$ ./node_modules/uglify-js/bin/uglifyjs ./lib/modules/p5Custom.js -o ./lib/modules/p5Custom.test.js -c
$ ls -lh ./lib/modules/
2.5M p5Custom.js
207K p5Custom.min.js
1.3M p5Custom.pre-min.js
> 1.2M p5Custom.test.js Peace 🖖 |
Resolved with the merge of #3956 (review). |
Nature of issue?
Most appropriate sub-area of p5.js?
Which platform were you using when you encountered this?
Details about the bug:
npm run grunt combineModules:core/shape:color:math:image
which outputs a 2.5M
lib/modules/p5Custom.js
compared to the full
p5.min.js
at 543KFeature enhancement details:
I've created and committed a potential update to
tasks/build/combineModules.js
which enables minification using uglify similar to the existing Grunt task for browserify and uglify.npm run grunt combineModules:core/shape:color:math:image
which outputs a 2.5M
lib/modules/p5Custom.js
npm run grunt combineModules:min:core/shape:color:math:image
which outputs a 1.3M
lib/modules/p5Custom.pre-min.js
npm run grunt combineModules:min:core/shape:color:math:image uglify
which outputs a 207K
lib/modules/p5Custom.min.js
The full minified
p5.min.js
is 543K,p5.pre-min.js
is 2.9M, andp5.js
is 4M.After discussion, I'm happy to create a new pull request and will update the
custom_p5_build.md
doc before doing so.This could help alleviate any wait on larger build system updates enabling smaller bundles.
The text was updated successfully, but these errors were encountered: