Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bun-plugin-glsl

UstymUkhman18MIT0.1.0TypeScript support: included

Import, inline (and minify) GLSL/WGSL shader files

bun, glsl, webgl, bunjs, webgpu, plugin, threejs, shaders, bun-plugin, glsl-shaders, webgl-shaders, webgpu-shaders

readme

Bun Plugin GLSL

Import, inline (and minify) GLSL/WGSL shader files

GitHub package.json version GitHub

Inspired by vite-plugin-glsl, compatible with Babylon.js, three.js and lygia.

Installation

bun add bun-plugin-glsl --dev

Usage

import glsl from 'bun-plugin-glsl';

Bun.plugin(glsl());

With TypeScript

Add extension declarations to your types in tsconfig.json:

{
  "compilerOptions": {
    "types": [
      "bun-plugin-glsl/ext"
    ]
  }
}

or as a package dependency directive to your global types:

/// <reference types="bun-plugin-glsl/ext" />

Default Options

glsl({
  include: /\.(glsl|wgsl|vert|frag|vs|fs)$/, // RegExp of file extensions to import
  removeDuplicatedImports: false,            // Automatically remove an already imported chunk
  warnDuplicatedImports: true,               // Warn if the same chunk was imported multiple times
  defaultExtension: 'glsl',                  // Shader suffix when no extension is specified
  minify: false,                             // Minify/optimize output shader code
  watch: true,                               // Recompile shader on change
  root: '/'                                  // Directory for root imports
})