vite-gleam
v1.7.1
Published
Import directly from *.gleam files using Vite
Readme
vite-gleam 
Import from Gleam (*.gleam) files directly.
Given the version number X.Y.Z, X refers to a breaking change, Y refers to the Vite version, and Z refers to a minor change.
Usage
npm i vite-gleam- Create a basic Vite project (
npm create vite) - Create a
gleam.tomland add Gleam dependencies - Update your vite config
// vite.config.{ts,js}
import gleam from "vite-gleam";
export default {
plugins: [gleam()],
};- Start importing from Gleam!
Note
By default, TypeScript (LSP) will complain about importing files with the .gleam extension. There are two choices for fixes:
- If the type of the import doesn't matter , add
declare module "*.gleam";inside any TypeScript file. A caveat is the LSP does not know if an export exists so it will not provide autocompletion when importing a Gleam file and it will type exports asany. - Alternatively, if the vite dev server is running you can have full type safety when importing from Gleam.
npm i ts-gleam. Create atsconfig.json/jsconfig.jsonand setcompilerOptions.pluginsto[{"name": "ts-gleam"}]
