Our blazing fast Grid component built with pure JavaScript


Post by gregc »

If I have a page where I just want to grab a couple of components, essentially do this

<script type='module'>
import { Button, TextField  } from '/bryntum/grid-4.2.7/grid.module.js'
</script>

I can do it, works fine, but that page now has an extra 3mb download (yes one time but still).

I could alternatively do

import TextField from '/bryntum/grid-4.2.7/lib/Core/widget/TextField.js';

and that works, but then it downloads 20 or so individual files as in goes through the dependencies.

Not too familiar with all this, I guess ideally I would be able to import some small core.module.min.js but not sure any of that is possible?


Post by Animal »

The TextField is part of a hierarchy. It extends Field which extends Widget and mixes in the Badge mixin. Widget then mixes in several other mixins it needs to operate. It will use DomHelper and EventHelper and other classes to perform its complex functionality.

There will be code.

Separate imports as in your second case will perform well in the near future when all browsers support HTTP2 and all 20 things it depends on will arrive fast:

https://betterprogramming.pub/2020-004-the-rollout-of-modules-is-complete-d25f04870284

Until then, bundles are with us.


Post by gregc »

thanks


Post Reply