Codebases & bundles
Codebases & bundles is Beta, only works with TypeScript and is an Enterprise feature for the time being.
The traditional way to handle codebases on Windmill is two-fold:
- Using relative imports to import scripts from the same workspace.
- Deploy a private/public packages and import them in your scripts using the package manager.
However, that can be inconvenient when working with large codebases.
Bundles
To work with large codebases, there is another mode of deployment that relies on the same mechanism as similar services like Lambda or cloud functions: a bundle is built locally by the CLI using esbuild and deployed to Windmill.
This bundle contains all the code and dependencies needed to run the script.
On the latest version of the Windmill CLI, it is done automatically on wmill sync push
for any script that falls in the patterns of includes and excludes as defined by the wmill.yaml.
wmill.yaml
Here are the changes needed in your wmill.yaml
:
---
codebases:
- relative_path: ../codebase
includes:
- '**'
excludes: []
Windmill keeps track of the hash of the codebase and will only rebuild the bundle if the codebase or script has changed.
Instance object storage
The bundles requires instance-wide object storage which is where the bundle resides.
VS Code extension
This mode of deployment automatically works with the VS Code extension to run preview by recognizing the codebases
configuration in wmill.yaml and bundling scripts on the fly using the same esbuild.
Example repository
An example repository with codebases and bundles can be found on GitHub.