change in v5: `const {inspect} = require('util');` can lead to web bundle bloat
See original GitHub issueThis was added in v5 for deserializeError
:
const {inspect} = require('util');
This adds about 8KB to web bundles, which can be significant, especially in projects not using deserializeError
.
Possible solutions:
- Not worry about 8KB and tell developers to use v4 if bundle size is of concern.
- Separate
serializeError
into a separate file that can be imported without thedeserializeError
code. - Separate
deserializeError
into a new module. - Publish code with ES6-style
import
, addsideEffects: false
to thepackage.json
to enable tree shaking in the module. - Other ideas?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Util | Node.js v19.3.0 Documentation
inspect () will invoke and use the result of when inspecting the object. const util = require('node:util'); class Box { constructor( ...
Read more >Webpack bundled library is different from the one in a Node.js ...
Library util is specific for node environment. You can not bundle it in webpack to be served in the browser.
Read more >A comprehensive study of bloated dependencies in the Maven ...
We propose DepClean, a tool to determine the presence of bloated dependencies in Maven artifacts. We analyze 9,639 Java artifacts hosted on ...
Read more >Authoring Libraries | webpack
We install lodash as devDependencies instead of dependencies because we don't want to bundle it into our library, or our library could be...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
status:RESOLVED resolution:OBSOLETE severity:minor · Bug:130127 - "sys-kernel/module-rebuild doesn't understand "build-on-demand"" status:RESOLVED ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for this issue. I think this is a really handy lib and making it universal is a good idea! I support this approach:
Basically the only reason for using
inspect
here is to be able to find out what happened right? Just for debugging purposes? I think if there is some light weight way to implement this that’d be ideal, maybe just useJSON.stringify
if it’s an object?PR placed: #27.