React-ace: Reduce bundle size

Created on 5 Oct 2017  路  12Comments  路  Source: securingsincity/react-ace

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?

help wanted issue with ace

Most helpful comment

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

All 12 comments

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

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

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

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

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

Looking forward for good answer to this.

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

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.

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

any idea that we can reduce the bundle size?

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bobcui001 picture Bobcui001  路  5Comments

ghiden picture ghiden  路  3Comments

ponelat picture ponelat  路  3Comments

nenadlukic picture nenadlukic  路  6Comments

huangjiatian picture huangjiatian  路  7Comments