react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

Reduce bundle size

Open fumblehool opened this issue 8 years ago • 14 comments

I analyzed my bundle.js using webpack-bundle-analyzer and It is nearly half the size of total bundle. I've tried different releases of react-ace but all have same result

screen shot 2017-10-05 at 5 52 26 pm

How can I reduce the bundle size?

fumblehool avatar Oct 05 '17 12:10 fumblehool

unfortunately @fumblehool brace and ace are enormous libraries. I would love to find a way to reduce the bundle size as well.

securingsincity avatar Oct 10 '17 12:10 securingsincity

Is there some way to do this? I would love to help you.

fumblehool avatar Oct 11 '17 09:10 fumblehool

I would be open to any help. I'm not sure what it is that is driving the size other than the dependencies.

securingsincity avatar Oct 12 '17 18:10 securingsincity

You could split your bundle on top level routes which use react-ace. For example, if you have a route /posts/new for a page, which includes the editor, you could load the page's component asynchronously with System.import.

In react-router 3 this is possible by using getComponent prop on <Route>

This won't solve the problem of the huge size of ace and brace, and I think that nothing would, every wysiwyg library is huge in size. But at least your website won't load this extra 1 mb of data when it is not needed

ignatevdev avatar Oct 17 '17 14:10 ignatevdev

Brace makes up to 66% of my relatively complex SPA build with webpack (create-react-app).

Do you know any way to reduce the size of brace? Is there any aggressive minification you can apply? It would really help

jan-osch avatar Oct 23 '18 08:10 jan-osch

Looking forward for good answer to this.

MarvanN avatar Apr 11 '19 21:04 MarvanN

I built a tool to help you analyze webpack bundles for size regressions, and report them directly to GitHub PRs. It's free for open source, so it might be worth checking out and helpful in this scenario.

https://packtracker.io

image

jondavidjohn avatar May 31 '19 16:05 jondavidjohn

so with v8 of react-ace we've dropped support for brace and only should be importing the ace files you absolutely need. In theory bundle sizes should be smaller but i haven't tested this.

securingsincity avatar Oct 13 '19 19:10 securingsincity

Not really, it's even a bit worse as brace was 640.83KB whereas ace-builds is 665.48KB. It's huge :/

TeoTN avatar Oct 23 '19 13:10 TeoTN

any idea that we can reduce the bundle size?

rongyadong avatar Aug 19 '20 08:08 rongyadong

I would so like to have the bundle size reduced. Currently, I am using code splitting to lazy load the editor component.

Srinjoy-Santra avatar Oct 11 '20 17:10 Srinjoy-Santra

Running into the same problem where the bundle size is unacceptable for my project. I was trying react-syntax-highlighter because they have a light version. May be worth looking into how they handle it. I think the ace plugin is actually better and was hoping it had a similar light version.

https://github.com/react-syntax-highlighter/react-syntax-highlighter#light-build

travisdahl avatar Feb 08 '21 22:02 travisdahl

I also need a lighter version. Having an sql editor with textmate theme and auto-completion is more than enough for my work. Don't need any other fancy features in that.

ashishRudder avatar Jan 20 '22 15:01 ashishRudder

I also need a lighter version. Having an sql editor with textmate theme and auto-completion is more than enough for my work. Don't need any other fancy features in that.

indeed, i just want a functional json editor to a very small and simple project, and all other features that i will not use worries me.

Awesome work by the way

Bonfims avatar Jul 19 '23 13:07 Bonfims