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.

Reducing size of monaco-editor dependency

See original GitHub issue

Hi, I was doing a check of my node_modules folder in a medium sized project and I’m using monaco-editor as a dependency. Monaco-editor ended up being the largest dependency by size in my node_modules folder at 29MB.

I used the following command on Mac OS X to check this:

du -sm node_modules/* | sort -rn | head -n 20

I wanted to see why monaco-editor was taking up so much space so I checked the folder itself:

> du -sm node_modules/monaco-editor/*
1	node_modules/monaco-editor/CHANGELOG.md
1	node_modules/monaco-editor/LICENSE
1	node_modules/monaco-editor/README.md
1	node_modules/monaco-editor/ThirdPartyNotices.txt
16	node_modules/monaco-editor/dev
6	node_modules/monaco-editor/min
7	node_modules/monaco-editor/min-maps
1	node_modules/monaco-editor/monaco.d.ts
1	node_modules/monaco-editor/package.json

Those sizes are in MB. I noticed that monaco-editor ends up packaging “dev”, “min” and “min-maps” in its package.

Since the npm monaco-editor package seems to be built by using a subset of the vscode repository, I was wondering if it was also possible to produce a reduced subset of the monaco-editor repository for people who don’t need the “dev” and “min-maps” directories. Perhaps as “monaco-editor-min” or a separate package since npm doesn’t support it under the same name. This would significantly reduce the size of package needed for a number of users seeing as how monaco-editor is downloaded over ten thousand times a month according to npm stats (https://www.npmjs.com/package/monaco-editor).

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:10
  • Comments:5

github_iconTop GitHub Comments

4reactions
tjb1019commented, Aug 5, 2021

Today I have installed and found it is 81.3 MB (85,336,064 bytes) of the entire “monaco-editor” in the production build, which is huge. Would appreciate any suggestions to reduce the size of it.

I am using:

"monaco-editor": "^0.26.1",
"ngx-monaco-editor": "^12.0.0",

Update your glob input and output in angular.json to only copy the min version to /assets.

{ "glob": "**/*", "input": "node_modules/monaco-editor/min", "output": "assets/monaco-editor/min" }
2reactions
rajibhasan11commented, Jul 30, 2021

Today I have installed and found it is 81.3 MB (85,336,064 bytes) of the entire “monaco-editor” in the production build, which is huge. Would appreciate any suggestions to reduce the size of it.

I am using:

"monaco-editor": "^0.26.1",
"ngx-monaco-editor": "^12.0.0",
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reducing size of monaco-editor dependency #463 - GitHub
Today I have installed and found it is 81.3 MB (85,336,064 bytes) of the entire "monaco-editor" in the production build, which is huge....
Read more >
Dynamic imports: Speeding up the initial loading time of ...
The size of the Monaco Editor dependency is pretty extensive, roughly around 15mb. This becomes smaller when minimized and gzipped of course ...
Read more >
Reducing bundle size of a production application
I got a production application where its bundle size is 8.06MB. # Console log from npm build File sizes after gzip: 1.67 MB...
Read more >
monaco-editor-webpack-plugin - npm
Monaco Editor Webpack Loader Plugin. A plugin to simplify loading the Monaco Editor with webpack.
Read more >
@materia-ui/ngx-monaco-editor - npm package | Snyk
Support flex-box container and correctly resize editor when container size changes. @materia-ui/ngx-monaco-editor dependencies. tslib ...
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