0.0.1 ā¢ Published 6 months ago
esbuild-plugin-raw2 v0.0.1
esbuild-plugin-raw2
š£ A ESBuild plugin to handler raw file.
Requirements
This plugin requires an LTS Node version (v14.0.0+) and ESbuild v0.18.0+.
Install
Using pnpm:
pnpm add esbuild-plugin-raw2 -D
Usage
ESbuild Config
import { defineConfig } from "esbuild";
import raw from "esbuild-plugin-raw2";
export default defineConfig({
/* ... */
plugins: [
raw({
filter: /\.(txt|glsl|fs)$/i,
}),
],
});
test.txt
Content
hello world
will transform to
export default "hello world";
JS Code
import txt from "./test.txt";
console.log(txt);
Options
filter
Type: RegExp
Required
The RegExp to match raw file.
0.0.1
6 months ago