🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

esbuild-plugin-glsl

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
e

esbuild-plugin-glsl

An esbuild plugin that adds support for shader imports.

1.4.0
latest
72

Supply Chain Security

100

Vulnerability

87

Quality

91

Maintenance

100

License

Version published
Weekly downloads
1.5K
13.04%
Maintainers
1
Weekly downloads
 
Created
Issues
0

esbuild-plugin-glsl

CI Version

An esbuild plugin that adds support for .frag, .vert, .glsl and .wgsl file imports with optional shader minification.

Installation

npm install esbuild-plugin-glsl

Usage

import { build } from "esbuild";
import { glsl } from "esbuild-plugin-glsl";

build({
	entryPoints: ["input.js"],
	outfile: "output.js",
	bundle: true,
	plugins: [glsl({
		minify: true
	})]
});

Options

OptionDescriptionDefault
minifyEnables or disables basic shader minification.follows minify
resolveIncludesWhen enabled, shaders can include other shaders with the custom #include "path" directive.true
preserveLegalCommentsPreserves comments that start with //! or /*! or include @license or @preserve.follows legal-comments

TypeScript

To make the TypeScript compiler know how to handle shader sources, add a shaders.d.ts ambient declaration file to your project:

declare module "*.wgsl" {
	const value: string;
	export default value;
}

declare module "*.glsl" {
	const value: string;
	export default value;
}

declare module "*.frag" {
	const value: string;
	export default value;
}

declare module "*.vert" {
	const value: string;
	export default value;
}

Contributing

Use the issue tracker to propose and discuss changes. Maintain the existing coding style. Lint and test your code.

FAQs

Package last updated on 20 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts