loadLanguages utility causes bloat with webpack
See original GitHub issueI’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:
- Created 5 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top 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 >
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 Free
Top 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
The dependency graph can be inferred from the data from
components.js
orcomponents.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).The babel plugin is ready here: https://www.npmjs.com/package/babel-plugin-prismjs