A Vite plugin for @sap/cds (CAP) that enables importing .cds model files, running cds watch with Vite, and using the @sap/cds runtime in the browser. Current version 0.2.0 supports @sap/cds ^9. Release cadence is irregular with multiple minor patches. Key differentiators: allows using Vite's HMR and bundling for CAP frontends, and enables running the CAP runtime inside the browser via polyfills. Requires peer dependency @sap/cds ^9.
npm install vite-plugin-cdsVerified import paths — ran on the pinned version, not inferred.
Import a .cds model file in a Vite app using the plugin. The plugin compiles the model at build time.
Use Vite 5 or later.
If you need to disable minify, configure Vite's build.minify or use a custom rollup plugin.
Avoid relying on cds.context for per-request state in browser usage.
Run npm install @sap/cds
Ensure you import cds from '@sap/cds', not from the plugin: import cds from '@sap/cds'
Run npm install vite@5