@carbon/telemetry pollutes our production code with unused development dependencies and impacts load performance
See original GitHub issueWhat package(s) are you using?
- [x ]
carbon-components
- [ x]
carbon-components-vue
Detailed description
With v10.27.0 @carbon/telemetry was added, and has really bad impact on our product. For our application, we are using @carbon/vue, which picked telemetry with 2.37.1.
After updating to the new version, we found
- many new dependencies added as production dependencies in our package-lock.json
- and a growth of our distribution package of over 200% (from 26MB to 47MB, see below)
We already tried to address that, see https://ibm-cloud.slack.com/archives/CAM5P6NR1/p1612864854039900 https://github.com/carbon-design-system/carbon-components-vue/issues/1142
but the only answer was that we can opt out by using CARBON_TELEMETRY_DISABLED. But setting CARBON_TELEMETRY_DISABLED doesnβt prevent any of the issues we have:
- The raised footprint of the generated chunk-vendors.js layer slows down our performance.
- We must ship components/code we never use, which need to be maintained and monitored for vulnerabilities, security flaws etc.
- We need to get open-source clearance for all these newly added packages, for components that we donβt require at all
Such a utility module must not impact the productβs code in such heavy manner.
Is this issue related to a specific component? n/a
What did you expect to happen? What happened instead? What would you like to see changed?
Expecting
- same build behavior when doing minor version updates
- a clean production dependency tree without unused libs/code
Happend:
- The raised footprint of the generated chunk-vendors.js layer slows down our performance.
- We must ship components/code we never use, which need to be maintained and monitored for vulnerabilities, security flaws etc.
- We need to get open-source clearance for all these newly added packages, for components that we donβt require at all
What needs to change:
Telemetry code running only as node installation hook during development phase must not contribute to the appβs production package. Therefore redesign telemetry copmonent to be a development package or drop it.
What browser are you working in? n/a
What version of the Carbon Design System are you using? see package.json below
What offering/product do you work on? Any pressing ship or release dates we should be aware of? IBM Digital Business Automation Cloud Portal app
Steps to reproduce the issue
1.Have an app built on carbo/vue 2.37.0
2. Check build sizes and dependency tree with node ls --prod
3. update to carbon/vue 2.37.1+
4. repeat step 2
Please create a reduced test case in CodeSandbox n/a
Additional information
For comparison, here are some examples of our app, before and after moving to version @carbon/vue 2.38.2, and therefore before and after added telemetry. Especially check the changed size of the chunk-vendors layer: 16Mb before, 37Mb afterwards and the quite small dependencies tree before and the very large one aftrwerwards:
Before update:
$ cat package.json { βnameβ: βcom.ibm.automation.cloud.instance.ui.dbaocβ, βdependenciesβ: { β@carbon/vueβ: β2.37.0β, βcore-jsβ: β3.12.1β, βlodashβ: β4.17.21β, βvueβ: β2.6.12β, βvue-i18nβ: β8.24.4β, βvue-routerβ: β3.5.1β }, β¦ }
$ du -h dist 68K dist/img 604K dist/css 25M dist/js 300K dist/vendor/jquery-ui/i18n 300K dist/vendor/jquery-ui 636K dist/vendor 26M dist
$ du -ha dist/js/* 468K dist/js/admin-access-management.ec4b79d1.js 3.3M dist/js/admin-reports.8a3b9a58.js 724K dist/js/admin-system-operations.9059c77c.js 3.9M dist/js/app.283180c5.js 16M dist/js/chunk-vendors.27d0cff5.js
$ npm ls --prod
com.ibm.automation.cloud.instance.ui.dbaoc@1.0.0
βββ¬ @carbon/vue@2.37.0
β βββ¬ @carbon/icons-vue@10.20.0
β β βββ @carbon/icon-helpers@10.17.0
β βββ¬ carbon-components@10.23.1
β β βββ flatpickr@4.6.1
β β βββ lodash.debounce@4.0.8
β β βββ¬ warning@3.0.0
β β βββ¬ loose-envify@1.4.0
β β βββ js-tokens@4.0.0
β βββ flatpickr@4.6.3
β βββ vue@2.6.12 deduped
βββ core-js@3.12.1
βββ lodash@4.17.21
βββ vue@2.6.12
βββ vue-i18n@8.24.4
βββ vue-router@3.5.1
After update (no other changes):
package.json { βnameβ: βcom.ibm.automation.cloud.instance.ui.dbaocβ βdependenciesβ: { β@carbon/vueβ: β2.38.2β, βcore-jsβ: β3.12.1β, βlodashβ: β4.17.21β, βvueβ: β2.6.12β, βvue-i18nβ: β8.24.4β, βvue-routerβ: β3.5.1β }, β¦ }
$ du -h dist 68K dist/img 604K dist/css 45M dist/js 300K dist/vendor/jquery-ui/i18n 300K dist/vendor/jquery-ui 636K dist/vendor 47M dist
$ du -ha dist/js/* 468K dist/js/admin-access-management.8b5d2bd7.js 3.3M dist/js/admin-reports.874e1cb5.js 724K dist/js/admin-system-operations.b017aac0.js 3.9M dist/js/app.c226d3a2.js 37M dist/js/chunk-vendors.49f119cd.js
$ npm ls --prod
com.ibm.automation.cloud.instance.ui.dbaoc@1.0.0
βββ¬ @carbon/vue@2.38.2
β βββ¬ @carbon/icons-vue@10.27.0
β β βββ @carbon/icon-helpers@10.18.0
β βββ¬ @carbon/telemetry@0.0.0-alpha.6
β β βββ @babel/parser@7.14.3
β β βββ¬ @babel/traverse@7.14.2
β β β βββ¬ @babel/code-frame@7.12.13
β β β β βββ¬ @babel/highlight@7.14.0
β β β β βββ @babel/helper-validator-identifier@7.14.0 deduped
β β β β βββ¬ chalk@2.4.2
β β β β β βββ¬ ansi-styles@3.2.1
β β β β β β βββ¬ color-convert@1.9.3
β β β β β β βββ color-name@1.1.3
β β β β β βββ escape-string-regexp@1.0.5
β β β β β βββ¬ supports-color@5.5.0
β β β β β βββ has-flag@3.0.0
β β β β βββ js-tokens@4.0.0 deduped
β β β βββ¬ @babel/generator@7.14.3
β β β β βββ @babel/types@7.14.2 deduped
β β β β βββ jsesc@2.5.2
β β β β βββ source-map@0.5.7
β β β βββ¬ @babel/helper-function-name@7.14.2
β β β β βββ¬ @babel/helper-get-function-arity@7.12.13
β β β β β βββ @babel/types@7.14.2 deduped
β β β β βββ¬ @babel/template@7.12.13
β β β β β βββ @babel/code-frame@7.12.13 deduped
β β β β β βββ @babel/parser@7.14.3 deduped
β β β β β βββ @babel/types@7.14.2 deduped
β β β β βββ @babel/types@7.14.2 deduped
β β β βββ¬ @babel/helper-split-export-declaration@7.12.13
β β β β βββ @babel/types@7.14.2 deduped
β β β βββ @babel/parser@7.14.3 deduped
β β β βββ¬ @babel/types@7.14.2
β β β β βββ @babel/helper-validator-identifier@7.14.0
β β β β βββ to-fast-properties@2.0.0
β β β βββ¬ debug@4.3.1
β β β β βββ ms@2.1.2
β β β βββ globals@11.12.0
β β βββ ci-info@2.0.0
β β βββ¬ configstore@5.0.1
β β β βββ¬ dot-prop@5.3.0
β β β β βββ is-obj@2.0.0
β β β βββ graceful-fs@4.2.6 deduped
β β β βββ¬ make-dir@3.1.0
β β β β βββ semver@6.3.0
β β β βββ¬ unique-string@2.0.0
β β β β βββ crypto-random-string@2.0.0
β β β βββ¬ write-file-atomic@3.0.3
β β β β βββ imurmurhash@0.1.4
β β β β βββ is-typedarray@1.0.0
β β β β βββ signal-exit@3.0.3
β β β β βββ¬ typedarray-to-buffer@3.1.5
β β β β βββ is-typedarray@1.0.0 deduped
β β β βββ xdg-basedir@4.0.0
β β βββ¬ fast-glob@3.2.5
β β β βββ @nodelib/fs.stat@2.0.5
β β β βββ¬ @nodelib/fs.walk@1.2.7
β β β β βββ¬ @nodelib/fs.scandir@2.1.5
β β β β β βββ @nodelib/fs.stat@2.0.5
β β β β β βββ¬ run-parallel@1.2.0
β β β β β βββ queue-microtask@1.2.3
β β β β βββ¬ fastq@1.11.0
β β β β βββ reusify@1.0.4
β β β βββ¬ glob-parent@5.1.2
β β β β βββ¬ is-glob@4.0.1
β β β β βββ is-extglob@2.1.1
β β β βββ merge2@1.4.1
β β β βββ¬ micromatch@4.0.4
β β β β βββ¬ braces@3.0.2
β β β β β βββ¬ fill-range@7.0.1
β β β β β βββ¬ to-regex-range@5.0.1
β β β β β βββ is-number@7.0.0
β β β β βββ picomatch@2.2.3 deduped
β β β βββ picomatch@2.2.3
β β βββ¬ fs-extra@9.1.0
β β β βββ at-least-node@1.0.0
β β β βββ graceful-fs@4.2.6
β β β βββ¬ jsonfile@6.1.0
β β β β βββ graceful-fs@4.2.6 deduped
β β β β βββ universalify@2.0.0 deduped
β β β βββ universalify@2.0.0
β β βββ¬ got@11.8.2
β β β βββ @sindresorhus/is@4.0.1
β β β βββ¬ @szmarczak/http-timer@4.0.5
β β β β βββ defer-to-connect@2.0.1
β β β βββ¬ @types/cacheable-request@6.0.1
β β β β βββ @types/http-cache-semantics@4.0.0
β β β β βββ¬ @types/keyv@3.1.1
β β β β β βββ @types/node@15.3.1 deduped
β β β β βββ @types/node@15.3.1
β β β β βββ @types/responselike@1.0.0 deduped
β β β βββ¬ @types/responselike@1.0.0
β β β β βββ @types/node@15.3.1 deduped
β β β βββ cacheable-lookup@5.0.4
β β β βββ¬ cacheable-request@7.0.2
β β β β βββ¬ clone-response@1.0.2
β β β β β βββ mimic-response@1.0.1
β β β β βββ¬ get-stream@5.2.0
β β β β β βββ¬ pump@3.0.0
β β β β β βββ¬ end-of-stream@1.4.4
β β β β β β βββ once@1.4.0 deduped
β β β β β βββ¬ once@1.4.0
β β β β β βββ wrappy@1.0.2
β β β β βββ http-cache-semantics@4.1.0
β β β β βββ¬ keyv@4.0.3
β β β β β βββ json-buffer@3.0.1
β β β β βββ lowercase-keys@2.0.0 deduped
β β β β βββ normalize-url@6.0.1
β β β β βββ responselike@2.0.0 deduped
β β β βββ¬ decompress-response@6.0.0
β β β β βββ mimic-response@3.1.0
β β β βββ¬ http2-wrapper@1.0.3
β β β β βββ quick-lru@5.1.1
β β β β βββ resolve-alpn@1.1.2
β β β βββ lowercase-keys@2.0.0
β β β βββ p-cancelable@2.1.1
β β β βββ¬ responselike@2.0.0
β β β βββ lowercase-keys@2.0.0 deduped
β β βββ¬ semver@7.3.5
β β β βββ¬ lru-cache@6.0.0
β β β βββ yallist@4.0.0
β β βββ¬ winston@3.3.3
β β β βββ¬ @dabh/diagnostics@2.0.2
β β β β βββ¬ colorspace@1.1.2
β β β β β βββ¬ color@3.0.0
β β β β β β βββ¬ color-convert@1.9.3
β β β β β β β βββ color-name@1.1.3
β β β β β β βββ¬ color-string@1.5.5
β β β β β β βββ color-name@1.1.4 deduped
β β β β β β βββ¬ simple-swizzle@0.2.2
β β β β β β βββ is-arrayish@0.3.2
β β β β β βββ text-hex@1.0.0
β β β β βββ enabled@2.0.0
β β β β βββ kuler@2.0.0
β β β βββ async@3.2.0
β β β βββ is-stream@2.0.0
β β β βββ¬ logform@2.2.0
β β β β βββ colors@1.4.0
β β β β βββ fast-safe-stringify@2.0.7
β β β β βββ fecha@4.2.1
β β β β βββ ms@2.1.2 deduped
β β β β βββ triple-beam@1.3.0 deduped
β β β βββ¬ one-time@1.0.0
β β β β βββ fn.name@1.1.0
β β β βββ¬ readable-stream@3.6.0
β β β β βββ inherits@2.0.4
β β β β βββ¬ string_decoder@1.1.1
β β β β β βββ safe-buffer@5.1.2 deduped
β β β β βββ util-deprecate@1.0.2
β β β βββ stack-trace@0.0.10
β β β βββ triple-beam@1.3.0
β β β βββ¬ winston-transport@4.4.0
β β β βββ¬ readable-stream@2.3.7
β β β β βββ core-util-is@1.0.2
β β β β βββ inherits@2.0.4 deduped
β β β β βββ isarray@1.0.0
β β β β βββ process-nextick-args@2.0.1
β β β β βββ safe-buffer@5.1.2
β β β β βββ string_decoder@1.1.1 deduped
β β β β βββ util-deprecate@1.0.2 deduped
β β β βββ triple-beam@1.3.0 deduped
β β βββ¬ yargs@16.2.0
β β βββ¬ cliui@7.0.4
β β β βββ string-width@4.2.2 deduped
β β β βββ¬ strip-ansi@6.0.0
β β β β βββ ansi-regex@5.0.0
β β β βββ¬ wrap-ansi@7.0.0
β β β βββ¬ ansi-styles@4.3.0
β β β β βββ¬ color-convert@2.0.1
β β β β βββ color-name@1.1.4
β β β βββ string-width@4.2.2 deduped
β β β βββ strip-ansi@6.0.0 deduped
β β βββ escalade@3.1.1
β β βββ get-caller-file@2.0.5
β β βββ require-directory@2.1.1
β β βββ¬ string-width@4.2.2
β β β βββ emoji-regex@8.0.0
β β β βββ is-fullwidth-code-point@3.0.0
β β β βββ strip-ansi@6.0.0 deduped
β β βββ y18n@5.0.8
β β βββ yargs-parser@20.2.7
β βββ¬ carbon-components@10.30.0
β β βββ @carbon/telemetry@0.0.0-alpha.6 deduped
β β βββ flatpickr@4.6.1
β β βββ lodash.debounce@4.0.8
β β βββ¬ warning@3.0.0
β β βββ¬ loose-envify@1.4.0
β β βββ js-tokens@4.0.0
β βββ flatpickr@4.6.9
β βββ vue@2.6.12 deduped
βββ core-js@3.12.1
βββ lodash@4.17.21
βββ vue@2.6.12
βββ vue-i18n@8.24.4
βββ vue-router@3.5.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Since we didnβt get any solution or acceptance here, and we are not willing to use such a missused package tree (packaging dependencies on a web library), we started to work around this by locally overriding the telemetry package with a dummy package w/o any dependencies. However, we are happy if we can get a clean solution from carbon in the (near) future. So if you like, you can close this issue with βwonβt fixβ or keep it open if you think this is a valid issue.
Just to reiterate what was shared above, this package is following a typical structure for a CLI package. It does not have a
main
,module
,exports
, etc. entrypoint and lists abin
entrypoint for the CLI. The dependencies listed by the package are necessary for the CLI to function.None of the code for the CLI, or dependencies for the CLI, should be included in any bundle shipped to a user. If there is evidence of this happening, please provide steps for us to reproduce and we can investigate. It most likely is a specific bundler that is being impacted versus a general problem.
It seems that, in this case, the specific issue is that
@carbon/telemetry
is considered a production dependency instead of a development dependency. As a result, when installing production dependencies it will be included in anode_modules
folder if you havecarbon-components
,carbon-components-react
, etc listed underdependencies
.On our end, the only direction we can take is to list out dependencies under
devDependencies
and publish the package as a pre-built file that includes the dependencies. Weβll definitely investigate this path and see how feasible it is πIβll go ahead and mark this as closed. If folks are running into a bundle size issue thatβs being delivered to an end-user, please make an issue with steps to reproduce and we will 100% look into it.