vite-gleam
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

vite-gleam npm

Import from Gleam (*.gleam) files directly.

Usage

  1. npm i vite-gleam
  2. Create a basic Vite project (npm create vite)
  3. Create a gleam.toml and add Gleam dependencies
  4. Update your vite config
// vite.config.{ts,js}
import gleam from "vite-gleam";

export default {
  plugins: [gleam()],
};
  1. 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 doesnt matter , add declare module "*.gleam"; inside any TypeScript file. A caveat is the LSP does not know if a export exists so it will not provide autocompletion when importing a Gleam file and it will type exports as any.
  • Alternatively, if the vite dev server is running you can have full type safety when importing from Gleam. npm i ts-gleam. Create a tsconfig.json/jsconfig.json and set compilerOptions.plugins to [{"name": "ts-gleam"}] (RECOMMENDED)

Readme

Keywords

Package Sidebar

Install

npm i vite-gleam

Weekly Downloads

38

Version

0.4.2

License

MIT

Unpacked Size

12.4 kB

Total Files

7

Last publish

Collaborators

  • endercheif