nestauk / health_mosaic_ui

Health Mosaic User Interface
MIT License
0 stars 0 forks source link

Investigate dependencies tree-shakeability #97

Open mindrones opened 5 years ago

mindrones commented 5 years ago

We're now using the new rollup's option treeshake.moduleSideEffects for lamb (see [1]), we should investigate how to detect purity in other dependencies, especially the big ones like xstate.

There is and will be work on auto-detect side-effects in rollup [2] but while we wait for that to be solved completely we need a way to at least list pure modules if we feel it's the case and if the lib is not too difficult to inspect.

[1] https://github.com/mindrones/lambsplittest/commit/db02018ff8e4034788af45bf7bd63c907de2e602#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R19

[2] rollup PR 2844:

Why would we even want this instead of further improving the side-effect detection (rest assured, we ARE still improving this one as well!) [...]

mindrones commented 5 years ago

I tried some rollup plugins to output the bundle sizes:

1) rollup-plugin-size-snapshot: the current release doesn't as it expects output being a string, while we pass the object returned by config.client.output():

{
  "dir": "path/to/__sapper__/dev/client",
  "entryFileNames": "[name].[hash].js",
  "chunkFileNames": "[name].[hash].js",
  "format": "esm",
  "sourcemap": false
}

patching this with:

-const output = outputOptions.file;
+const output = outputOptions.file || outputOptions.dir;

we get [1] but notice that it's very slow (it takes many seconds at least here):

[1] (patched version) ``` Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 196 B browser parsing size (minified with terser): 150 B download size (minified and gzipped): 133 B treeshaked with rollup with production NODE_ENV and minified: 142 B import statements size of it: 96 B treeshaked with webpack in production mode: 1,196 B [repo]/src/client.js: app - 132 B (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 14,781 B browser parsing size (minified with terser): 7,874 B download size (minified and gzipped): 2,860 B treeshaked with rollup with production NODE_ENV and minified: 0 B import statements size of it: 0 B treeshaked with webpack in production mode: 969 B [repo]/src/client.js: svelte - 40 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 6,003 B browser parsing size (minified with terser): 4,254 B download size (minified and gzipped): 1,403 B treeshaked with rollup with production NODE_ENV and minified: 28 B import statements size of it: 28 B treeshaked with webpack in production mode: 1,012 B [repo]/src/client.js: app - 4.8 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 3,826 B browser parsing size (minified with terser): 1,068 B download size (minified and gzipped): 551 B treeshaked with rollup with production NODE_ENV and minified: 28 B import statements size of it: 28 B treeshaked with webpack in production mode: 1,012 B [repo]/src/client.js: svelte - 3.83 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 37,329 B browser parsing size (minified with terser): 21,993 B download size (minified and gzipped): 4,990 B treeshaked with rollup with production NODE_ENV and minified: 112 B import statements size of it: 112 B treeshaked with webpack in production mode: 1,637 B [repo]/src/client.js: app - 22.91 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 176,640 B browser parsing size (minified with terser): 81,013 B download size (minified and gzipped): 19,153 B treeshaked with rollup with production NODE_ENV and minified: 751 B import statements size of it: 56 B treeshaked with webpack in production mode: 1,768 B [repo]/src/client.js: xstate - 147.28 KB (86.18%) app - 23.61 KB (13.82%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 81,800 B browser parsing size (minified with terser): 8,748 B download size (minified and gzipped): 3,450 B treeshaked with rollup with production NODE_ENV and minified: 2,540 B import statements size of it: 47 B treeshaked with webpack in production mode: 5,329 B [repo]/src/client.js: lamb - 233.25 KB (97.55%) app - 5.86 KB (2.45%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 6,265 B browser parsing size (minified with terser): 3,296 B download size (minified and gzipped): 1,357 B treeshaked with rollup with production NODE_ENV and minified: 226 B import statements size of it: 226 B treeshaked with webpack in production mode: 1,441 B [repo]/src/client.js: app - 545 B (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 637 B browser parsing size (minified with terser): 519 B download size (minified and gzipped): 271 B treeshaked with rollup with production NODE_ENV and minified: 0 B import statements size of it: 0 B treeshaked with webpack in production mode: 1,092 B [repo]/src/client.js: rollup helpers - 686 B (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 11,448 B browser parsing size (minified with terser): 6,749 B download size (minified and gzipped): 2,157 B treeshaked with rollup with production NODE_ENV and minified: 28 B import statements size of it: 28 B treeshaked with webpack in production mode: 1,012 B [repo]/src/client.js: app - 2.29 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 21,894 B browser parsing size (minified with terser): 14,419 B download size (minified and gzipped): 5,817 B treeshaked with rollup with production NODE_ENV and minified: 140 B import statements size of it: 140 B treeshaked with webpack in production mode: 1,256 B [repo]/src/client.js: app - 25.46 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 17,453 B browser parsing size (minified with terser): 7,918 B download size (minified and gzipped): 2,587 B treeshaked with rollup with production NODE_ENV and minified: 140 B import statements size of it: 140 B treeshaked with webpack in production mode: 1,256 B [repo]/src/client.js: app - 12.95 KB (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 507,284 B browser parsing size (minified with terser): 238,362 B download size (minified and gzipped): 60,321 B treeshaked with rollup with production NODE_ENV and minified: 138,918 B import statements size of it: 389 B treeshaked with webpack in production mode: 141,483 B [repo]/src/client.js: app - 116.55 KB (23.59%) graphql - 98.82 KB (20.00%) apollo-client - 97.8 KB (19.80%) apollo-cache-inmemory - 43.15 KB (8.74%) apollo-utilities - 34.29 KB (6.94%) optimism - 18.05 KB (3.65%) zen-observable - 15.4 KB (3.12%) tslib - 8.83 KB (1.79%) @wry/context - 7.99 KB (1.62%) apollo-link - 6.55 KB (1.33%) ts-invariant - 6.1 KB (1.23%) apollo-link-http - 5.6 KB (1.13%) apollo-boost - 5.22 KB (1.06%) graphql-tag - 5.13 KB (1.04%) apollo-cache - 4.94 KB (1.00%) @wry/equality - 4.82 KB (0.98%) apollo-link-http-common - 4.73 KB (0.96%) apollo-link-error - 3.28 KB (0.66%) just-compare - 2.06 KB (0.42%) fast-json-stable-stringify - 1.8 KB (0.36%) ionicons - 1.6 KB (0.32%) symbol-observable - 736 B (0.15%) rollup helpers - 399 B (0.08%) zen-observable-ts - 167 B (0.03%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 2,314 B browser parsing size (minified with terser): 1,517 B download size (minified and gzipped): 773 B treeshaked with rollup with production NODE_ENV and minified: 226 B import statements size of it: 226 B treeshaked with webpack in production mode: 1,441 B [repo]/src/client.js: app - 338 B (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 818 B browser parsing size (minified with terser): 583 B download size (minified and gzipped): 340 B treeshaked with rollup with production NODE_ENV and minified: 0 B import statements size of it: 0 B treeshaked with webpack in production mode: 1,159 B [repo]/src/client.js: sapper - 804 B (100.00%) Computed sizes of "__sapper__/dev/client" with "esm" format bundler parsing size: 670,481 B browser parsing size (minified with terser): 666,927 B download size (minified and gzipped): 168,245 B treeshaked with rollup with production NODE_ENV and minified: 666,803 B import statements size of it: 47 B treeshaked with webpack in production mode: 667,788 B [repo]/src/client.js: mapbox-gl - 655.5 KB (100.00%) ```

2) rollup-plugin-sizes: works, outputs this kind of info [1] and could be used to track down the bigger dependency to investigate first.

Simple version (I replaced the original path to the repo with `[repo]`, it's much less readable) ``` [repo]/src/client.js: svelte - 40 KB (100.00%) [repo]/src/client.js: svelte - 3.83 KB (100.00%) [repo]/src/client.js: @sapper/app.mjs - 12.58 KB (69.85%) app - 2.91 KB (16.16%) @sapper/internal - 2.52 KB (13.99%) [repo]/src/client.js: app - 132 B (100.00%) [repo]/src/client.js: app - 4.8 KB (100.00%) [repo]/src/client.js: lamb - 233.25 KB (97.55%) app - 5.86 KB (2.45%) [repo]/src/client.js: app - 22.91 KB (100.00%) [repo]/src/client.js: xstate - 147.28 KB (86.18%) app - 23.61 KB (13.82%) [repo]/src/client.js: app - 25.46 KB (100.00%) [repo]/src/client.js: app - 116.55 KB (23.59%) graphql - 98.82 KB (20.00%) apollo-client - 97.8 KB (19.80%) apollo-cache-inmemory - 43.15 KB (8.74%) apollo-utilities - 34.29 KB (6.94%) optimism - 18.05 KB (3.65%) zen-observable - 15.4 KB (3.12%) tslib - 8.83 KB (1.79%) @wry/context - 7.99 KB (1.62%) apollo-link - 6.55 KB (1.33%) ts-invariant - 6.1 KB (1.23%) apollo-link-http - 5.6 KB (1.13%) apollo-boost - 5.22 KB (1.06%) graphql-tag - 5.13 KB (1.04%) apollo-cache - 4.94 KB (1.00%) @wry/equality - 4.82 KB (0.98%) apollo-link-http-common - 4.73 KB (0.96%) apollo-link-error - 3.28 KB (0.66%) just-compare - 2.06 KB (0.42%) fast-json-stable-stringify - 1.8 KB (0.36%) ionicons - 1.6 KB (0.32%) symbol-observable - 736 B (0.15%) rollup helpers - 399 B (0.08%) zen-observable-ts - 167 B (0.03%) [repo]/src/client.js: app - 2.29 KB (100.00%) [repo]/src/client.js: rollup helpers - 686 B (100.00%) [repo]/src/client.js: app - 545 B (100.00%) [repo]/src/client.js: app - 338 B (100.00%) [repo]/src/client.js: app - 12.95 KB (100.00%) [repo]/src/client.js: sapper - 804 B (100.00%) [repo]/src/client.js: mapbox-gl - 655.5 KB (100.00%) copy: node_modules/mapbox-gl/dist/mapbox-gl.css > static/mapbox-gl.css ```
Detailed version (I replaced the original path to the repo with `[repo]`, it's much less readable) ``` [repo]/src/client.js: svelte - 40 KB (100.00%) internal/index.mjs - 40 KB (100.00%) [repo]/src/client.js: svelte - 3.83 KB (100.00%) store/index.mjs - 3.71 KB (96.71%) index.mjs - 129 B (3.29%) [repo]/src/client.js: @sapper/app.mjs - 12.58 KB (69.85%) - 12.58 KB (100.00%) app - 2.91 KB (16.16%) routes/_error.css - 1.64 KB (56.41%) routes/_layout.css - 670 B (22.48%) routes/_error.html - 497 B (16.68%) routes/_layout.html - 132 B (4.43%) @sapper/internal - 2.52 KB (13.99%) manifest-client.mjs - 1.66 KB (65.87%) App.svelte - 773 B (29.95%) shared.mjs - 108 B (4.18%) [repo]/src/client.js: app - 132 B (100.00%) client.js - 132 B (100.00%) [repo]/src/client.js: app - 4.8 KB (100.00%) routes/index.css - 3.43 KB (71.44%) routes/index.html - 1.37 KB (28.56%) [repo]/src/client.js: lamb - 233.25 KB (97.55%) src/index.js - 10.78 KB (4.62%) src/array/sort.js - 2.82 KB (1.21%) src/object/setPathIn.js - 2.82 KB (1.21%) src/object/updatePathIn.js - 2.47 KB (1.06%) src/array/sortedInsert.js - 2.08 KB (0.89%) src/object/checker.js - 2.04 KB (0.87%) src/core/partialRight.js - 2.03 KB (0.87%) src/object/getPathIn.js - 1.98 KB (0.85%) src/logic/adapter.js - 1.85 KB (0.79%) src/function/asPartial.js - 1.83 KB (0.78%) src/array/group.js - 1.83 KB (0.78%) src/core/partial.js - 1.73 KB (0.74%) src/core/slice.js - 1.7 KB (0.73%) src/array/index.js - 1.69 KB (0.73%) src/array/everyIn.js - 1.68 KB (0.72%) src/function/invoker.js - 1.58 KB (0.68%) src/object/setIn.js - 1.56 KB (0.67%) src/array/transpose.js - 1.53 KB (0.65%) src/array/uniquesBy.js - 1.5 KB (0.64%) src/object/updateIn.js - 1.49 KB (0.64%) src/object/hasPathValue.js - 1.49 KB (0.64%) src/array/someIn.js - 1.46 KB (0.62%) src/logic/areSame.js - 1.45 KB (0.62%) src/object/skipKeys.js - 1.4 KB (0.60%) src/object/pickKeys.js - 1.39 KB (0.60%) src/logic/is.js - 1.34 KB (0.57%) src/object/validate.js - 1.33 KB (0.57%) src/math/isSafeInteger.js - 1.33 KB (0.57%) src/math/range.js - 1.32 KB (0.57%) src/core/isSVZ.js - 1.31 KB (0.56%) src/privates/_asPartial.js - 1.3 KB (0.56%) src/object/rename.js - 1.29 KB (0.56%) src/array/groupBy.js - 1.29 KB (0.55%) src/object/updatePath.js - 1.27 KB (0.55%) src/object/mergeOwn.js - 1.27 KB (0.54%) src/logic/condition.js - 1.26 KB (0.54%) src/function/debounce.js - 1.24 KB (0.53%) src/core/areSVZ.js - 1.21 KB (0.52%) src/array/unionBy.js - 1.21 KB (0.52%) src/object/pathSatisfies.js - 1.21 KB (0.52%) src/array/getIndex.js - 1.21 KB (0.52%) src/function/curry.js - 1.21 KB (0.52%) src/object/pathExists.js - 1.21 KB (0.52%) src/array/partitionWith.js - 1.2 KB (0.52%) src/function/curryable.js - 1.2 KB (0.51%) src/object/pickIf.js - 1.19 KB (0.51%) src/object/validateWith.js - 1.19 KB (0.51%) src/logic/unless.js - 1.17 KB (0.50%) src/array/flatMap.js - 1.15 KB (0.49%) src/logic/when.js - 1.15 KB (0.49%) src/object/keys.js - 1.15 KB (0.49%) src/array/insert.js - 1.15 KB (0.49%) src/array/sortWith.js - 1.14 KB (0.49%) src/object/immutable.js - 1.12 KB (0.48%) src/array/findIndex.js - 1.12 KB (0.48%) src/function/collect.js - 1.1 KB (0.47%) src/logic/case.js - 1.09 KB (0.47%) src/array/difference.js - 1.09 KB (0.47%) src/array/find.js - 1.07 KB (0.46%) src/object/make.js - 1.07 KB (0.46%) src/object/pathExistsIn.js - 1.07 KB (0.46%) src/privates/_makeReducer.js - 1.07 KB (0.46%) src/object/skip.js - 1.05 KB (0.45%) src/function/aritize.js - 1.05 KB (0.45%) src/array/isIn.js - 1.04 KB (0.45%) src/array/pullFrom.js - 1.03 KB (0.44%) src/privates/_currier.js - 1.03 KB (0.44%) src/function/tapArgs.js - 1.03 KB (0.44%) src/function/throttle.js - 1.03 KB (0.44%) src/object/merge.js - 1.02 KB (0.44%) src/privates/_invoker.js - 1.02 KB (0.44%) src/privates/_curry.js - 1.01 KB (0.44%) src/core/sliceAt.js - 1.01 KB (0.43%) src/array/countBy.js - 1.01 KB (0.43%) src/array/union.js - 1 KB (0.43%) src/object/updateKey.js - 1 KB (0.43%) src/type/isInstanceOf.js - 1 KB (0.43%) src/array/count.js - 1 KB (0.43%) src/core/forEach.js - 1 KB (0.43%) src/array/updateIndex.js - 1 KB (0.43%) src/core/compose.js - 1022 B (0.43%) src/array/pull.js - 1020 B (0.43%) src/privates/_setPathIn.js - 1020 B (0.43%) src/array/updateAt.js - 1012 B (0.42%) src/array/setAt.js - 1011 B (0.42%) src/array/indexBy.js - 1009 B (0.42%) src/array/intersection.js - 998 B (0.42%) src/string/repeat.js - 996 B (0.42%) src/object/setKey.js - 994 B (0.42%) src/logic/anyOf.js - 990 B (0.41%) src/core/map.js - 987 B (0.41%) src/array/dropWhile.js - 979 B (0.41%) src/function/curryableRight.js - 974 B (0.41%) src/function/pipe.js - 973 B (0.41%) src/object/renameKeys.js - 968 B (0.41%) src/array/takeWhile.js - 967 B (0.40%) src/privates/_getInsertionIndex.js - 966 B (0.40%) src/logic/gt.js - 961 B (0.40%) src/logic/lt.js - 959 B (0.40%) src/array/filter.js - 956 B (0.40%) src/array/getAt.js - 950 B (0.40%) src/array/sorter.js - 947 B (0.40%) src/array/sorterDesc.js - 947 B (0.40%) src/function/curryRight.js - 946 B (0.40%) src/object/hasOwn.js - 946 B (0.40%) src/object/renameWith.js - 946 B (0.40%) src/object/pick.js - 941 B (0.39%) src/object/getPath.js - 940 B (0.39%) src/object/fromPairs.js - 926 B (0.39%) src/object/ownPairs.js - 924 B (0.39%) src/privates/_checkPredicates.js - 922 B (0.39%) src/privates/_flatten.js - 921 B (0.39%) src/privates/_getPathInfo.js - 917 B (0.38%) src/object/has.js - 915 B (0.38%) src/array/uniques.js - 914 B (0.38%) src/array/reduceRightWith.js - 913 B (0.38%) src/core/clamp.js - 909 B (0.38%) src/array/dropFrom.js - 907 B (0.38%) src/logic/isGTE.js - 905 B (0.38%) src/logic/isLTE.js - 902 B (0.38%) src/math/isInteger.js - 894 B (0.37%) src/function/getArgAt.js - 888 B (0.37%) src/core/reduceWith.js - 879 B (0.37%) src/function/invokerOn.js - 879 B (0.37%) src/object/skipIf.js - 875 B (0.37%) src/math/generate.js - 870 B (0.36%) src/object/setPath.js - 869 B (0.36%) src/array/takeFrom.js - 867 B (0.36%) src/array/partition.js - 866 B (0.36%) src/array/pluck.js - 860 B (0.36%) src/array/take.js - 858 B (0.36%) src/array/drop.js - 857 B (0.36%) src/array/insertAt.js - 857 B (0.36%) src/object/hasKeyValue.js - 857 B (0.36%) src/array/pluckKey.js - 854 B (0.36%) src/string/padRight.js - 854 B (0.36%) src/string/padLeft.js - 853 B (0.36%) src/function/mapArgs.js - 851 B (0.36%) src/object/mapValues.js - 849 B (0.36%) src/logic/isGT.js - 844 B (0.35%) src/logic/gte.js - 836 B (0.35%) src/logic/lte.js - 833 B (0.35%) src/math/isFinite.js - 833 B (0.35%) src/object/tearOwn.js - 832 B (0.35%) src/array/setIndex.js - 830 B (0.35%) src/logic/isLT.js - 829 B (0.35%) src/privates/_sorter.js - 826 B (0.35%) src/object/hasOwnKey.js - 826 B (0.35%) src/array/some.js - 818 B (0.34%) src/core/clampWithin.js - 802 B (0.34%) src/math/modulo.js - 801 B (0.34%) src/array/filterWith.js - 794 B (0.33%) src/array/every.js - 792 B (0.33%) src/array/findIndexWhere.js - 792 B (0.33%) src/logic/allOf.js - 787 B (0.33%) src/core/reduce.js - 784 B (0.33%) src/object/enumerables.js - 780 B (0.33%) src/math/remainder.js - 776 B (0.32%) src/privates/_setIndex.js - 765 B (0.32%) src/object/hasKey.js - 763 B (0.32%) src/object/ownValues.js - 763 B (0.32%) src/array/flatMapWith.js - 760 B (0.32%) src/core/always.js - 751 B (0.31%) src/array/zip.js - 751 B (0.31%) src/object/tear.js - 748 B (0.31%) src/array/contains.js - 743 B (0.31%) src/object/getKey.js - 743 B (0.31%) src/privates/_compareWith.js - 740 B (0.31%) src/privates/_makePartial3.js - 738 B (0.31%) src/object/pairs.js - 734 B (0.31%) src/array/rotate.js - 733 B (0.31%) src/object/mapValuesWith.js - 715 B (0.30%) src/core/mapWith.js - 711 B (0.30%) src/array/findWhere.js - 710 B (0.30%) src/function/applyTo.js - 708 B (0.30%) src/privates/_immutable.js - 694 B (0.29%) src/array/append.js - 686 B (0.29%) src/array/reduceRight.js - 683 B (0.29%) src/object/keySatisfies.js - 678 B (0.28%) src/core/generic.js - 666 B (0.28%) src/array/appendTo.js - 653 B (0.27%) src/privates/_argsToArrayFrom.js - 652 B (0.27%) src/object/values.js - 643 B (0.27%) src/function/unary.js - 640 B (0.27%) src/privates/_tearFrom.js - 636 B (0.27%) src/core/binary.js - 630 B (0.26%) src/privates/_comparer.js - 617 B (0.26%) src/function/apply.js - 616 B (0.26%) src/math/randomInt.js - 615 B (0.26%) src/core/type.js - 614 B (0.26%) src/array/shallowFlatten.js - 598 B (0.25%) src/core/isNil.js - 597 B (0.25%) src/array/reverse.js - 594 B (0.25%) src/array/rotateBy.js - 593 B (0.25%) src/privates/_getPathKey.js - 586 B (0.25%) src/array/init.js - 584 B (0.24%) src/array/flatten.js - 583 B (0.24%) src/array/head.js - 570 B (0.24%) src/array/last.js - 570 B (0.24%) src/privates/_makeArrayChecker.js - 557 B (0.23%) src/array/zipWithIndex.js - 546 B (0.23%) src/math/deduct.js - 544 B (0.23%) src/privates/_groupWith.js - 543 B (0.23%) src/type/isType.js - 532 B (0.22%) src/string/testWith.js - 531 B (0.22%) src/object/getIn.js - 528 B (0.22%) src/math/divideBy.js - 525 B (0.22%) src/privates/_merge.js - 525 B (0.22%) src/privates/_getPadding.js - 525 B (0.22%) src/privates/_makeArrayFlattener.js - 514 B (0.22%) src/function/flip.js - 513 B (0.21%) src/privates/_makeCriteria.js - 500 B (0.21%) src/privates/_toNaturalIndex.js - 495 B (0.21%) src/array/tail.js - 489 B (0.20%) src/array/list.js - 485 B (0.20%) src/privates/_unsafeKeyListFrom.js - 479 B (0.20%) src/core/identity.js - 470 B (0.20%) src/privates/_valuesFrom.js - 465 B (0.19%) src/privates/_getNumConsecutiveHits.js - 463 B (0.19%) src/privates/_pairsFrom.js - 462 B (0.19%) src/core/isUndefined.js - 460 B (0.19%) src/math/multiplyBy.js - 456 B (0.19%) src/logic/not.js - 454 B (0.19%) src/privates/_isEnumerable.js - 452 B (0.19%) src/privates/_isArrayIndex.js - 451 B (0.19%) src/core/isNull.js - 433 B (0.18%) src/function/application.js - 431 B (0.18%) src/math/add.js - 418 B (0.18%) src/privates/_curry3.js - 417 B (0.17%) src/privates/_makeTypeErrorFor.js - 416 B (0.17%) src/privates/_toArrayLength.js - 405 B (0.17%) src/privates/_setIn.js - 404 B (0.17%) src/privates/_toInteger.js - 379 B (0.16%) src/privates/_argsTail.js - 376 B (0.16%) src/privates/_curry2.js - 358 B (0.15%) src/privates/_safeEnumerables.js - 350 B (0.15%) src/privates/_repeat.js - 347 B (0.15%) src/privates/_makeCriterion.js - 344 B (0.14%) src/privates/_isOwnEnumerable.js - 339 B (0.14%) src/core/__.js - 338 B (0.14%) src/privates/_keyToPairIn.js - 332 B (0.14%) src/math/multiply.js - 324 B (0.14%) src/math/subtract.js - 314 B (0.13%) src/math/divide.js - 312 B (0.13%) src/privates/_toPathParts.js - 310 B (0.13%) src/privates/_forceToNumber.js - 308 B (0.13%) src/math/sum.js - 289 B (0.12%) src/privates/_search.js - 275 B (0.12%) src/privates/_safeKeys.js - 244 B (0.10%) src/privates/_constants.js - 90 B (0.04%) app - 5.86 KB (2.45%) config.js - 3.81 KB (65.13%) util/transform.ts - 1.1 KB (18.86%) stores/search.ts - 960 B (16.01%) [repo]/src/client.js: app - 22.91 KB (100.00%) components/Map/Controls.css - 6.6 KB (28.80%) components/Map/Editor.css - 4.45 KB (19.42%) components/Map/Controls.html - 2.7 KB (11.79%) components/Map/Mapbox.css - 2.46 KB (10.73%) components/Map/Editor.html - 1.55 KB (6.77%) components/Map/Mapbox.html - 1.46 KB (6.35%) util/xstateHelper.ts - 1.44 KB (6.30%) stores/memo.ts - 713 B (3.04%) components/Map/Source.html - 490 B (2.09%) components/Map/Layer.html - 476 B (2.03%) components/Map/index.js - 257 B (1.10%) stores/bounds.ts - 239 B (1.02%) stores/index.ts - 134 B (0.57%) [repo]/src/client.js: xstate - 147.28 KB (86.18%) es/StateNode.js - 57.1 KB (38.77%) es/interpreter.js - 37.17 KB (25.24%) es/utils.js - 14.98 KB (10.17%) es/StateTree.js - 14.6 KB (9.91%) es/actions.js - 8.78 KB (5.96%) es/State.js - 6.55 KB (4.45%) es/scheduler.js - 2.04 KB (1.38%) es/match.js - 1.75 KB (1.19%) es/types.js - 1.1 KB (0.74%) es/mapState.js - 1.06 KB (0.72%) es/index.js - 791 B (0.52%) es/actionTypes.js - 728 B (0.48%) es/Machine.js - 280 B (0.19%) es/Actor.js - 171 B (0.11%) es/constants.js - 155 B (0.10%) es/environment.js - 105 B (0.07%) app - 23.61 KB (13.82%) components/Icons/Selector.css - 3.92 KB (16.59%) components/Icons/Toggle.css - 3.85 KB (16.31%) components/Icons/Trash.css - 1.94 KB (8.21%) components/Icons/Dots.css - 1.84 KB (7.80%) components/Icons/Toggle.html - 1.64 KB (6.95%) components/Icons/Selector.html - 1.43 KB (6.07%) components/Icons/Copy.css - 1.34 KB (5.66%) components/Icons/Trash.html - 1.01 KB (4.28%) components/Icons/Edit.html - 943 B (3.90%) components/Icons/Dots.html - 757 B (3.13%) components/Icons/Save.html - 735 B (3.04%) components/Icons/index.js - 629 B (2.60%) components/Icons/Copy.html - 592 B (2.45%) components/Icons/Undo.html - 591 B (2.44%) components/Icons/Delete.html - 561 B (2.32%) components/Icons/Alert.html - 557 B (2.30%) components/Icons/Close.html - 557 B (2.30%) components/Icons/Add.html - 490 B (2.03%) components/Icons/Pin.html - 389 B (1.61%) [repo]/src/client.js: app - 25.46 KB (100.00%) routes/present.css - 11.24 KB (44.15%) stores/test.js - 6.95 KB (27.28%) routes/present.html - 6.06 KB (23.80%) machines/present.ts - 1.22 KB (4.78%) [repo]/src/client.js: app - 116.55 KB (23.59%) routes/search/_layout.css - 12.83 KB (11.01%) machines/screen_machine.ts - 12.5 KB (10.72%) components/Nav.css - 9.82 KB (8.42%) components/QueryBuilder/QueryControls.css - 9.32 KB (8.00%) routes/search/_layout.html - 8.04 KB (6.90%) components/Spinner.css - 7.42 KB (6.36%) components/QueryBuilder/FormLabels.css - 5.81 KB (4.99%) components/QueryBuilder/RulesetLabels.css - 5.36 KB (4.60%) components/QueryBuilder/QueryControls.svelte - 5.06 KB (4.34%) components/QueryBuilder/Form.css - 4.92 KB (4.22%) components/QueryBuilder/FormInput.css - 4.24 KB (3.64%) components/Nav.svelte - 4.07 KB (3.49%) machines/search_machine.ts - 2.82 KB (2.42%) components/QueryBuilder/RulesetQueries.css - 2.5 KB (2.14%) components/QueryBuilder/RuleControlsMaster.css - 2.42 KB (2.07%) components/QueryBuilder/RulesetLabels.svelte - 2.36 KB (2.02%) components/QueryBuilder/Ruleset.css - 2.09 KB (1.79%) components/QueryBuilder/FormLabels.svelte - 2.01 KB (1.72%) components/Spinner.html - 1.76 KB (1.51%) components/QueryBuilder/RuleControls.css - 1.75 KB (1.50%) components/QueryBuilder/Form.svelte - 1.67 KB (1.43%) components/QueryBuilder/FormInput.svelte - 1.59 KB (1.36%) components/QueryBuilder/Rules.css - 1.19 KB (1.02%) actions/queryApi.js - 1.01 KB (0.87%) components/QueryBuilder/Ruleset.svelte - 940 B (0.79%) components/QueryBuilder/RuleControlsMaster.svelte - 909 B (0.76%) components/QueryBuilder/RulesetQueries.svelte - 852 B (0.71%) components/QueryBuilder/RuleControls.svelte - 708 B (0.59%) components/QueryBuilder/Rules.svelte - 281 B (0.24%) components/QueryBuilder/Rules.js - 242 B (0.20%) components/QueryBuilder/Form.js - 168 B (0.14%) graphql - 98.82 KB (20.00%) language/parser.mjs - 35.01 KB (35.43%) language/lexer.mjs - 15.87 KB (16.06%) language/visitor.mjs - 11.75 KB (11.90%) language/printer.mjs - 10.71 KB (10.83%) error/GraphQLError.mjs - 4.71 KB (4.76%) error/printError.mjs - 4.27 KB (4.33%) jsutils/inspect.mjs - 3.36 KB (3.40%) language/blockString.mjs - 2.89 KB (2.93%) language/kinds.mjs - 2.13 KB (2.15%) language/source.mjs - 1.23 KB (1.25%) jsutils/defineToStringTag.mjs - 1018 B (1.01%) language/directiveLocation.mjs - 1005 B (0.99%) error/locatedError.mjs - 922 B (0.91%) error/formatError.mjs - 852 B (0.84%) jsutils/defineToJSON.mjs - 811 B (0.80%) language/location.mjs - 723 B (0.71%) error/syntaxError.mjs - 561 B (0.55%) error/index.mjs - 423 B (0.42%) jsutils/invariant.mjs - 390 B (0.39%) jsutils/nodejsCustomInspectSymbol.mjs - 355 B (0.35%) apollo-client - 97.8 KB (19.80%) bundle.esm.js - 97.8 KB (100.00%) apollo-cache-inmemory - 43.15 KB (8.74%) lib/bundle.esm.js - 43.15 KB (100.00%) apollo-utilities - 34.29 KB (6.94%) lib/bundle.esm.js - 34.29 KB (100.00%) optimism - 18.05 KB (3.65%) lib/bundle.esm.js - 18.05 KB (100.00%) zen-observable - 15.4 KB (3.12%) lib/Observable.js - 15.35 KB (99.62%) index.js - 60 B (0.38%) tslib - 8.83 KB (1.79%) tslib.es6.js - 8.83 KB (100.00%) @wry/context - 7.99 KB (1.62%) lib/context.esm.js - 7.99 KB (100.00%) apollo-link - 6.55 KB (1.33%) lib/bundle.esm.js - 6.55 KB (100.00%) ts-invariant - 6.1 KB (1.23%) lib/invariant.esm.js - 2.5 KB (41.04%) lib/invariant.esm.js - 1.8 KB (29.48%) lib/invariant.esm.js - 1.8 KB (29.48%) apollo-link-http - 5.6 KB (1.13%) lib/bundle.esm.js - 5.6 KB (100.00%) apollo-boost - 5.22 KB (1.06%) lib/bundle.esm.js - 5.22 KB (100.00%) graphql-tag - 5.13 KB (1.04%) src/index.js - 5.13 KB (100.00%) apollo-cache - 4.94 KB (1.00%) lib/bundle.esm.js - 4.94 KB (100.00%) @wry/equality - 4.82 KB (0.98%) lib/equality.esm.js - 4.82 KB (100.00%) apollo-link-http-common - 4.73 KB (0.96%) lib/bundle.esm.js - 4.73 KB (100.00%) apollo-link-error - 3.28 KB (0.66%) lib/bundle.esm.js - 3.28 KB (100.00%) just-compare - 2.06 KB (0.42%) index.js - 2.06 KB (100.00%) fast-json-stable-stringify - 1.8 KB (0.36%) index.js - 1.8 KB (100.00%) ionicons - 1.6 KB (0.32%) dist/ionicons/svg/ios-close-circle-outline.svg - 891 B (54.53%) dist/ionicons/svg/ios-add-circle-outline.svg - 743 B (45.47%) symbol-observable - 736 B (0.15%) es/index.js - 403 B (54.76%) es/ponyfill.js - 333 B (45.24%) rollup helpers - 399 B (0.08%) [repo]/node_modules/graphql/language/parser.mjs?commonjs-proxy - 233 B (58.40%) [repo]/node_modules/zen-observable/lib/Observable.js?commonjs-proxy - 166 B (41.60%) zen-observable-ts - 167 B (0.03%) lib/bundle.esm.js - 167 B (100.00%) [repo]/src/client.js: app - 2.29 KB (100.00%) components/Results/ResultsItem.css - 1023 B (43.66%) components/Results/Results.css - 632 B (26.97%) components/Results/ResultsItem.html - 418 B (17.84%) components/Results/Results.html - 156 B (6.66%) components/Results/index.js - 114 B (4.87%) [repo]/src/client.js: rollup helpers - 686 B (100.00%) commonjsHelpers.js - 686 B (100.00%) [repo]/src/client.js: app - 545 B (100.00%) routes/search/index.html - 545 B (100.00%) [repo]/src/client.js: app - 338 B (100.00%) routes/search/[facet].html - 338 B (100.00%) [repo]/src/client.js: app - 12.95 KB (100.00%) machines/memo.ts - 4.96 KB (38.27%) routes/map.css - 4.91 KB (37.87%) routes/map.html - 3.09 KB (23.87%) [repo]/src/client.js: sapper - 804 B (100.00%) sapper-dev-client.js - 804 B (100.00%) [repo]/src/client.js: mapbox-gl - 655.5 KB (100.00%) dist/mapbox-gl.js - 655.5 KB (100.00%) copy: node_modules/mapbox-gl/dist/mapbox-gl.css > static/mapbox-gl.css ```

3) rollup-plugin-filesize:

We get:

``` ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.add84ca9.js │ │ Bundle Size: 14.44 KB │ │ Minified Size: 7.69 KB │ │ Gzipped Size: 2.79 KB │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.6510baaa.js │ │ Bundle Size: 3.74 KB │ │ Minified Size: 1.04 KB │ │ Gzipped Size: 551 B │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.977c9a21.js │ │ Bundle Size: 35.73 KB │ │ Minified Size: 20.14 KB │ │ Gzipped Size: 5.7 KB │ │ │ └─────────────────────────────────────┘ ┌──────────────────────────────────────┐ │ │ │ Bundle Name: client.ef6b5e99.js │ │ Bundle Size: 197 B │ │ Minified Size: 150 B │ │ Gzipped Size: 133 B │ │ │ └──────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: index.1c10fc58.js │ │ Bundle Size: 5.86 KB │ │ Minified Size: 4.15 KB │ │ Gzipped Size: 1.37 KB │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.5333e325.js │ │ Bundle Size: 79.88 KB │ │ Minified Size: 8.54 KB │ │ Gzipped Size: 3.37 KB │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.49cc884f.js │ │ Bundle Size: 36.46 KB │ │ Minified Size: 21.48 KB │ │ Gzipped Size: 4.87 KB │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.832119d3.js │ │ Bundle Size: 172.5 KB │ │ Minified Size: 79.11 KB │ │ Gzipped Size: 18.7 KB │ │ │ └─────────────────────────────────────┘ ┌───────────────────────────────────────┐ │ │ │ Bundle Name: present.03770dde.js │ │ Bundle Size: 21.38 KB │ │ Minified Size: 14.08 KB │ │ Gzipped Size: 5.68 KB │ │ │ └───────────────────────────────────────┘ ┌───────────────────────────────────────┐ │ │ │ Bundle Name: _layout.d4c9dd6c.js │ │ Bundle Size: 496.32 KB │ │ Minified Size: 232.78 KB │ │ Gzipped Size: 58.91 KB │ │ │ └───────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.c39c41b5.js │ │ Bundle Size: 11.18 KB │ │ Minified Size: 6.59 KB │ │ Gzipped Size: 2.11 KB │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: chunk.cd1405fb.js │ │ Bundle Size: 638 B │ │ Minified Size: 519 B │ │ Gzipped Size: 271 B │ │ │ └─────────────────────────────────────┘ ┌─────────────────────────────────────┐ │ │ │ Bundle Name: index.8a2f1d7a.js │ │ Bundle Size: 6.12 KB │ │ Minified Size: 3.22 KB │ │ Gzipped Size: 1.33 KB │ │ │ └─────────────────────────────────────┘ ┌───────────────────────────────────────┐ │ │ │ Bundle Name: [facet].c2b16932.js │ │ Bundle Size: 2.26 KB │ │ Minified Size: 1.48 KB │ │ Gzipped Size: 773 B │ │ │ └───────────────────────────────────────┘ ┌───────────────────────────────────┐ │ │ │ Bundle Name: map.3ccfa2f1.js │ │ Bundle Size: 17.04 KB │ │ Minified Size: 7.73 KB │ │ Gzipped Size: 2.53 KB │ │ │ └───────────────────────────────────┘ ┌─────────────────────────────────────────────────┐ │ │ │ Bundle Name: sapper-dev-client.66640646.js │ │ Bundle Size: 819 B │ │ Minified Size: 583 B │ │ Gzipped Size: 340 B │ │ │ └─────────────────────────────────────────────────┘ ┌─────────────────────────────────────────┐ │ │ │ Bundle Name: mapbox-gl.eca0ce44.js │ │ Bundle Size: 655.03 KB │ │ Minified Size: 651.3 KB │ │ Gzipped Size: 164.3 KB │ │ │ └─────────────────────────────────────────┘ ```
mindrones commented 5 years ago

We can check if dependencies have "sideEffects": false in package.json, with a script eventually.

It is unlikely that this will help much as not many packages will have that variable, but hopefully the bigger ones will (lamb has it for example).

mindrones commented 5 years ago

This plugin is the best I've found so far: https://github.com/doesdev/rollup-plugin-analyzer 👍, see https://github.com/nestauk/svizzle/commit/b1e377bebcd8a07d8e526c3a4c1838615e0665de

mindrones commented 5 years ago

There's a list of d3 modules sideEffects at https://github.com/d3/d3/issues/3131#issuecomment-517316673

(formatting the link as text as I'd rather not link this comment there).