question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

change in v5: `const {inspect} = require('util');` can lead to web bundle bloat

See original GitHub issue

This 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 the deserializeError code.
  • Separate deserializeError into a new module.
  • Publish code with ES6-style import, add sideEffects: false to the package.json to enable tree shaking in the module.
  • Other ideas?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rohan-deshpandecommented, Oct 11, 2019

Thanks for this issue. I think this is a really handy lib and making it universal is a good idea! I support this approach:

Or we could find a simpler way to show the type. It’s not important. It’s just a bonus to make it easier to debug passed values that are not really deserializable as errors.

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 use JSON.stringify if it’s an object?

0reactions
vladimirycommented, Mar 10, 2020

PR placed: #27.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found