Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reduce size of my custom build #1811

Closed
sanoorvishwa opened this issue Mar 14, 2019 · 6 comments
Closed

How to reduce size of my custom build #1811

sanoorvishwa opened this issue Mar 14, 2019 · 6 comments
Assignees
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. community-help-wanted This is a good issue for a contributor to take on and submit a solution front-burner question Further information is requested. Stack Overflow candidate

Comments

@sanoorvishwa
Copy link

This is in continuation to Issue #1715
We are trying to reduce the size of custom built project that uses node module botframework-webchat 4.2.1-0.
We found that the size of the file webchat.js in cdn is 1.74MB where as size of file webchat-minimal.js in cdn is 1.09MB only.

My question here is how webchat-minimal.js was built so that I can follow similar steps in my custom project so as to make my final built file size smaller.

Thanks in advance,
Vishwa

@compulim
Copy link
Contributor

I really want to do so. Will be great if you could help.

You can look at this sunburst chart to understand more, https://cdn.botframework.com/botframework-webchat/master/stats.html. (The sunburst chart is 30+ MB)

Few things:

  • Move Adaptive Cards out of bundle (Move Adaptive Cards attachment renderer to bundle #1302, -251 KB)
  • (Full bundle only) We are taking a big size hit by postcss, which is included by our sanitizer (sanitize-html)
    • See if there is any other smaller/better sanitizer than sanitize-html
  • Move from RxJS to core-js Observable (-208 KB)
    • DirectLineJS is using RxJS, and it's difficult to get it out unless we rewrite it

If we finish these tasks, we could possibly shave off 30-40% of file size.

The other thing to investigate, could we leverage code-splitting? Code-splitting in component is new to us (or anyone, I believe).

@compulim compulim added question Further information is requested. Stack Overflow candidate front-burner backlog Out of scope for the current iteration but it will be evaluated in a future release. labels Mar 14, 2019
@corinagum corinagum added community-help-wanted This is a good issue for a contributor to take on and submit a solution and removed Pending labels Mar 14, 2019
@kislakiruben
Copy link

See if there is any other smaller/better sanitizer than sanitize-html

You should look into Insane. Haven't worked with it yet, but it looks promising.

@compulim
Copy link
Contributor

@kislakiruben great to know about insane, but last update was 3 years ago. 😳

@sk2andy
Copy link

sk2andy commented Jul 14, 2019

I have the same issue - I cloned the repo, ran npm run bootstrapand then npm run install. The size of ./packages/bundle/dist/webchat-instrumented-minimal.js is 6.7MB

why are your CDN-Files way smaller?
In comparison: my react dom is 760 kb:
image

and your react dom is 105kb
image

So am I missing something in the build process? Is the bundle package not the one I have to look for?

@compulim
Copy link
Contributor

If you run npm run build or npm run watch, it is building for development, i.e. webpack --run-dev.

If you run npm run prepublishOnly, it is building for production, equals to webpack or webpack --mode production.

I believe the tree-shaking algorithm in development build is not as aggressive as production build.

@cwhitten
Copy link
Member

cwhitten commented Jan 2, 2020

Closing as stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. community-help-wanted This is a good issue for a contributor to take on and submit a solution front-burner question Further information is requested. Stack Overflow candidate
Projects
None yet
Development

No branches or pull requests

8 participants