-
Notifications
You must be signed in to change notification settings - Fork 5
Shimmed Dependencies
Some modules are shimmed (see Motivation below), and should not be installed as dependencies of a Zimlet. These include:
preact
preact-router
preact-redux
react-apollo
Other psuedo-modules are provided by zm-x-web
under the @zimbra-client
namespace. This namespace includes many exports from the main application; such as components, utility functions, decorators, GraphQL queries, and constants. This gives all Zimlets a safe subset of the code used in developing zm-x-web
. These psuedo-modules include:
@zimbra-client/graphql // Represents the `zm-x-web/src/graphql` folder
@zimbra-client/enhancers // Represents the `zm-x-web/src/enhancers` folder
@zimbra-client/constants // Represents the `zm-x-web/src/constants` folder
To use shims in a Zimlet, import them as if they are regular modules.
Shims are a work in progress. If you are a developer and you want to use a piece of code from zm-x-web
in a Zimlet, make a pull request to add more shims to the Zimlet Manager
- Add the shim module to
zm-x-web::src/lib/zimlet-manager/shims.js
. - Add the shimmed module name and named imports to the
build-shims.js
script. - (Optional) If not already included in the
SHIMMED_MODULES
list, add the module name tosrc/shims/index.js
in theSHIMMED_MODULES
list. - Run the build and make sure it works in a Zimlet.
zimlet-cli
evaluates Zimlets inside a sand boxed environment. This environment has a number of useful dependencies injected into it, these are referred to as shims. By injecting dependencies, Zimlets are able to reuse modules bundled into zm-x-web
without duplicating code.
Consider the preact
module that exists in the main application (zm-x-web
); and that preact
will also be used by the majority of Zimlets. Bundling a unique copy of preact
with every Zimlet will create a large amount of code duplication. Instead, there will be one copy of preact
and it is injected into the environments for a Zimlet at runtime.
- Home
- Client Tool
- Getting Started
- Creating Your Zimlet
- Zimlet Design Patterns
- Advanced