@genesislcap/vite-builder
v15.86.0
Published
Vite builder
Readme
Vite builder
Builder wrapping Vite bundler.
PWA and Service Worker
The pwa and serviceWorker options in genx.config.ts are supported by the Vite builder, matching the Webpack builder:
pwa: emitsmanifest.jsonand injects<link rel="manifest">,theme-colorand, wheniosis set, the Apple meta and touch-icon tags intoindex.html. Icon and manifest URLs usepwa.publicPath, falling back toPUBLIC_PATH.- Icons under
public/are served from there. Other icon paths are resolved from the app root and emitted todestination(defaulticons/). When two different files share a name there, the later one gets a content hash appended. - Icons are not resized, so a raster icon needs one entry per size. A warning is logged when one file is declared at several sizes.
- Tags
index.htmlalready has (samemetaname, or samelinkrel and sizes) are not added again.
- Icons under
serviceWorker: compilesserviceWorker.worker(relative tosrc/) into a classic script atassetName(default: the worker's file name with a.jsextension).assetNamemay include a directory.registrationis added toindex.html. Without it, genx adds a script that registers the worker once the page has loaded. Setregistration: falsewhen the app registers the worker itself.- Workbox
injectManifestfillsself.__WB_MANIFESTwith every emitted file except those matched byexclude. As in the Webpack builder, strings match as prefixes, functions receive{ asset }, and the default is[/\.map$/, /^manifest.*\.js$/]. - Files Vite names with a content hash are precached without a revision. Every other file, including those copied from
public/and icons emitted under a fixed name, gets one, so a changed file is fetched again. - Files over
maximumFileSizeToCachethatexcludedoesn't already drop are left out of the precache with a warning. precache: falsebuilds a worker that doesn't precache, so it needn't referenceself.__WB_MANIFEST.- Under
genx devthe worker is bundled on request and served atassetNameunder the public path, the URL it has in the build, with an empty precache manifest.
When neither option is configured, output remains unchanged.
Installation
To enable this module in your application, follow the steps below.
- Add
@genesislcap/vite-builderas a dependency in yourpackage.jsonfile. Whenever you change the dependencies of your project, ensure you run the$ npm run bootstrapcommand again. You can find more information in the package.json basics page.
{
...
"dependencies": {
...
"@genesislcap/vite-builder": "latest"
...
},
...
}API Docs
License
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact Genesis Global for more details.
Licensed components
Genesis low-code platform
