{"id":22601,"library":"vite-plugin-cds","title":"Vite Plugin for SAP CDS","description":"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.","status":"active","version":"0.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/Akatuoro/vite-plugin-cds","tags":["javascript","vite","plugin","cap","cds"],"install":[{"cmd":"npm install vite-plugin-cds","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-cds","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-cds","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency, provides the CDS runtime and compiler","package":"@sap/cds","optional":false}],"imports":[{"note":"Named export for the plugin factory. Default export is not provided.","wrong":"import cds from 'vite-plugin-cds' or const cds = require('vite-plugin-cds')","symbol":"cds","correct":"import { cds } from 'vite-plugin-cds'"},{"note":"Named export for the node polyfill plugin.","wrong":"import node from 'vite-plugin-cds'","symbol":"node","correct":"import { node } from 'vite-plugin-cds'"},{"note":"Named export for the CAP runtime plugin.","wrong":"import cap from 'vite-plugin-cds'","symbol":"cap","correct":"import { cap } from 'vite-plugin-cds'"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite'\nimport { cds } from 'vite-plugin-cds'\n\nexport default defineConfig({\n  plugins: [cds()],\n  root: './app',\n})\n\n// In your JavaScript file:\nimport cdsModel from './index.cds'\nconsole.log(cdsModel) // compiled CSN object","lang":"javascript","description":"Import a .cds model file in a Vite app using the plugin. The plugin compiles the model at build time."},"warnings":[{"fix":"Use Vite 5 or later.","message":"The plugin is designed for Vite 5+; compatibility with older Vite versions is not guaranteed.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"If you need to disable minify, configure Vite's build.minify or use a custom rollup plugin.","message":"The 'minify: false' option was removed in v0.1.10; manual chunks configuration may be needed.","severity":"deprecated","affected_versions":">=0.1.10"},{"fix":"Avoid relying on cds.context for per-request state in browser usage.","message":"When using the CAP runtime in the browser, cds.context is not unique per request/transaction due to limited async context tracking.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.2.0':33 '9':36,72 'allow':47 'browser':30,65 'bundl':53 'cadenc':38 'cap':11,55,61,76 'cds':5,15,19,77 'current':31 'depend':70 'differenti':46 'enabl':13,58 'file':17 'frontend':56 'hmr':51 'import':14 'insid':63 'irregular':40 'javascript':73 'key':45 'minor':43 'model':16 'multipl':42 'patch':44 'peer':69 'plugin':2,8,75 'polyfil':67 'releas':37 'requir':68 'run':18,59 'runtim':27,62 'sap':4 'sap/cds':10,26,35,71 'support':34 'use':24,48 'version':32 'via':66 'vite':1,7,22,49,74 'watch':20","created_at":"2026-04-27T17:06:02.661415+00:00","updated_at":"2026-04-27T17:06:02.661415+00:00","problems":[{"fix":"Run npm install @sap/cds","cause":"@sap/cds is not installed as a peer dependency.","error":"Cannot find module '@sap/cds'"},{"fix":"Ensure you import cds from '@sap/cds', not from the plugin: import cds from '@sap/cds'","cause":"cds imported from wrong source or not initialized.","error":"Uncaught TypeError: cds.compile is not a function"},{"fix":"Run npm install vite@5","cause":"Vite is not installed or version mismatch.","error":"The requested module 'vite' does not provide an export named 'defineConfig'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/Akatuoro/vite-plugin-cds","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-cds","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}