0.4.3 • Published 1 year ago
vite-gleam v0.4.3
vite-gleam 
Import from Gleam (*.gleam) files directly.
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"}](RECOMMENDED)