Kekule.js
Kekule.js copied to clipboard
dynamic module loading improves module import size?
We are importing Kekule like below
The size is huge, we only need IO, Editor, and ChemWidget modules. There is any way of importing modules with improved bundle sizes?
Can you provide examples of dynamic module loading please?
Hi @filoscoder, if only certain modules are needed, you can use the utils/jsMinifier/ to build a custom min js file including only those modules to reduce the file size. E.g.:
node utils/jsMinifier/run.js -m io,chemWidget -d my/dest/path
Then use the custom kekule.min.js (not kekule.js):
import { Kekule } from "path/kekule.min.js";
However, since the editor is the most complex widget in package and requires a lot of functions from other modules, the reduced size is quite limited in the method above (from 2.56MB to 2.15MB).
Hi @filoscoder, if only certain modules are needed, you can use the utils/jsMinifier/ to build a custom min js file including only those modules to reduce the file size. E.g.:
node utils/jsMinifier/run.js -m io,chemWidget -d my/dest/path
Then use the custom kekule.min.js (not kekule.js):
import { Kekule } from "path/kekule.min.js";
However, since the editor is the most complex widget in package and requires a lot of functions from other modules, the reduced size is quite limited in the method above (from 2.56MB to 2.15MB).
I'm not following where is utils/jsMinifier
, is a helper inside Kekule?
Anyways It seems pretty unnecessary to customize the build for such a tiny difference.
Thanks a lot for testing it beforehand!
The jsMinifier util is in the source code repo: https://github.com/partridgejiang/Kekule.js/tree/master/utils/jsMinifier , :).
The jsMinifier util is in the source code repo: https://github.com/partridgejiang/Kekule.js/tree/master/utils/jsMinifier , :).
niceee, thanks a lot 🤙🏼