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.

loadLanguages utility causes bloat with webpack

See original GitHub issue

I’m seeing lots of bloat when using the loadLanguages utility in webpack.

~30k:

var Prism = require ('prismjs')
require('prismjs/components/prism-ruby')

~755k:

var Prism = require ('prismjs')
var loadLanguages = require('prismjs/components/index')
loadLanguages(['ruby'])

Numbers are in development mode, non-gzipped. I checked a couple other languages to make sure it wasn’t a dependency loading issue with prism-ruby.js, but results were similar with other languages.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
Golmotecommented, May 13, 2018

The dependency graph can be inferred from the data from components.js or components.json. Here is a quick’n’dirty example of the dependency graph in latest release 1.14: https://codepen.io/anon/pen/mLKqPN Note that this does not take “peer dependencies” into account (discussed in #1393).

1reaction
mAAdhaTTahcommented, May 24, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with 'require' of files bloating up my javascript with ...
I am using Webpack to pull in .svg files which I can inline and use ... not cached the file yet, or when...
Read more >
Avoid webpack bloat: Optimize your dependencies - Zillow
A good way to catch dependency bloat is to track the size of your application. At Zillow, every time we push code, a...
Read more >
Finding the source of webpack bundle bloat - Lee Reamsnyder
In the main App bundle file ( App.107d1f6b.chunk.js ), you can see that the @material/ui package is a huge chunk, which I would...
Read more >
Shimming - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Why Do I Feel Bloated? Common Causes of Bloating
Bloating : The Many Possible Causes. The cause of belly bloat is a bit of a mystery in the medical world, and it...
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