There is currently a bunch of code used at runtime that needs to be bundled for runtime to work. This includes things like the createObservableObject, the Component that every component extends and several other functions used for doing common runtime operations.
Runtime currently sits at around 4.34kb minified.
This is okay but there there are many large functions and methods that are only needed for #for and #if expressions. e.g createObservableArray.
This is okay for full apps build under prism compile-app that are likely to need all these features but for components built with prism compile-component that don't use #for or #if they may not be needed and will be more expensive to distribute.
I propose a model where under compile-component it sends a object to the construction of the component that if there are iterator and conditional expressions then will a flick a boolean switch. If switches are not true then some functions will be filtered out of the prism runtime bundle.
For very simple components this could reduce bundle by 1/2.
This is drastically more simple approach to tree shaking which works through code resolving references and automatically cut things out. Currently decent tree shaking is out of scope for chef
There is currently a bunch of code used at runtime that needs to be bundled for runtime to work. This includes things like the
createObservableObject
, theComponent
that every component extends and several other functions used for doing common runtime operations.Runtime currently sits at around 4.34kb minified.
This is okay but there there are many large functions and methods that are only needed for
#for
and#if
expressions. e.gcreateObservableArray
.This is okay for full apps build under
prism compile-app
that are likely to need all these features but for components built withprism compile-component
that don't use#for
or#if
they may not be needed and will be more expensive to distribute.I propose a model where under
compile-component
it sends a object to the construction of the component that if there areiterator
andconditional
expressions then will a flick a boolean switch. If switches are not true then some functions will befilter
ed out of the prism runtime bundle.For very simple components this could reduce bundle by 1/2.
This is drastically more simple approach to tree shaking which works through code resolving references and automatically cut things out. Currently decent tree shaking is out of scope for chef