{"id":22558,"library":"vite-gleam","title":"vite-gleam","description":"Vite plugin to import Gleam (*.gleam) files directly in JavaScript/TypeScript projects. Current version 1.7.1 targets Vite 5 (Y digit reflects Vite major version, e.g., 1.x.y for Vite 4, 1.7.x for Vite 5). Released actively alongside Gleam ecosystem. Key differentiator: enables seamless integration of Gleam code into Vite builds without separate compilation step.","status":"active","version":"1.7.1","language":"javascript","source_language":"en","source_url":"https://github.com/Enderchief/gleam-tools#master","tags":["javascript","gleam","vite","vite-plugin","typescript"],"install":[{"cmd":"npm install vite-gleam","lang":"bash","label":"npm"},{"cmd":"yarn add vite-gleam","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-gleam","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; not compatible with CommonJS require()","wrong":"const gleam = require('vite-gleam')","symbol":"gleam","correct":"import gleam from 'vite-gleam'"},{"note":"Default export, not named","wrong":"import { gleam } from 'vite-gleam'","symbol":"gleam","correct":"import gleam from 'vite-gleam'"},{"note":"TypeScript type, not a runtime value; use 'import type'","wrong":"import { ViteGleamOptions } from 'vite-gleam'","symbol":"ViteGleamOptions","correct":"import type { ViteGleamOptions } from 'vite-gleam'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport gleam from 'vite-gleam';\n\nexport default defineConfig({\n  plugins: [gleam()],\n});","lang":"typescript","description":"Install vite-gleam, add plugin to Vite config, then import .gleam files directly."},"warnings":[{"fix":"Ensure vite-gleam version's Y digit matches Vite major version (e.g., 1.7.x for Vite 5). Check release notes for breaking changes between X increments.","message":"Breaking change: Vite major version update requires matching vite-gleam major version. Version format X.Y.Z where X is breaking, Y is Vite version, Z is minor.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Add `declare module \"*.gleam\";` in a .d.ts file or use ts-gleam for full type support.","message":"TypeScript LSP reports error when importing .gleam files without type declarations.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure gleam() is first in the plugins array.","message":"Plugin must be placed before other plugins that transform imports (like @vitejs/plugin-react).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install Gleam (https://gleam.run) and have a gleam.toml in project root.","message":"Gleam compiler must be installed separately; vite-gleam does not include it.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install vite-gleam` (dev dependency) and import using `import gleam from 'vite-gleam'`.","cause":"Missing installation or wrong import path.","error":"Error: Cannot find module 'vite-gleam'"},{"fix":"Set `\"type\": \"module\"` in package.json or rename file to .mjs.","cause":"Using ESM syntax in a CommonJS context.","error":"Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}