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

A la carte components -> reduce code size #39

Open
skbach opened this issue Sep 21, 2017 · 3 comments
Open

A la carte components -> reduce code size #39

skbach opened this issue Sep 21, 2017 · 3 comments

Comments

@skbach
Copy link

skbach commented Sep 21, 2017

Is there any way to only include certain components from the library, or is it all or nothing?

For example, in material-ui, you can

import Button from 'material-ui/Button';

instead of

import { Button } from 'material-ui';

Will I need to build my own version using npm and include it manually to get this behavior?

@njordhov
Copy link

Alternatively eliminate dead code by compiling with :optimizations :advanced

@skbach
Copy link
Author

skbach commented Sep 25, 2017

:optimzations :advanced does very little to help. Still results in a 1.4MB file before gzip, which is insanely huge, considering the rest of my stack (Clojurescript, React, Rum, Datascript) comes out to 1/6 that size, and those libraries are monsters as well. Icons and Components I'm not using remain in the file, probably because the library isn't Closure module aware?? Hence my idea of using rollup/webpack manually and then just including a script tag and externs.

@madvas
Copy link
Owner

madvas commented Sep 25, 2017

Solution for this is a new cljs feature :npm-deps, which allows to include npm packages directly and enables dead code elimination. But it's in first stages, still bit buggy, can't compile everything. I've been trying to compile material-ui, almost all good, but there few errors, that won't enable dead code elimination. I'm in contact with Antonio and working to resolve this.

Read more here:
https://anmonteiro.com/2017/03/requiring-node-js-modules-from-clojurescript-namespaces/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants