@vixen-js/plugin-import-flat
v0.1.0
Published
Esbuild plugin to import files as text plain
Downloads
72
Maintainers
Readme
Esbuild Plugin Import Flat
Esbuild Plugin to import files as text plain
Installation
pnpm install @vixen-js/plugin-import-flat
Usage
// build.mjs contents
import * as esbuild from "esbuild";
import flatImport from "@vixen-js/plugin-import-flat";
esbuild.build({
plugins: [flatImport()],
...
})
// main.ts contents
import styles from "./myStyles.css?raw"; // This file should be compiled as plain text by esbuild
// const styles = "[your myStyles file content]";
console.log(styles);
Options
export interface PluginOptions {
filterRegexp?: RegExp; // Default: /\?raw$/
namespace?: string; // Plugin instance identifier
transform?: (code: string, args: any) => Promise<string>; // Function to apply transformations to the file content
}