A Vite plugin that transforms matched files (e.g., LICENSE, .text, .glsl) into plain text strings, enabling direct import of file contents. Current stable version is 1.4.2, with regular releases. Key features include support for both named and default exports, automatic type declaration generation (.d.ts), sourcemaps, and ESM compatibility. Compared to alternatives like vite-plugin-virtual-plain-text, this plugin operates on real file paths rather than virtual modules.
npm install vite-plugin-plain-textVerified import paths — ran on the pinned version, not inferred.
Demonstrates Vite configuration with plainText plugin and importing file contents as strings.
Update imports to use named export 'plainText' or set namedExport: false to get default export.
Use namedExport: false explicitly instead of undefined or empty string.
Use patterns like '**/*.text' or /\/LICENSE$/ for reliability.
Add generated .d.ts files to .gitignore or use distAutoClean to remove them on startup.
Add manual module declarations in vite-env.d.ts or enable dtsAutoGen option.
Change import to use named import: import { plainText } from './LICENSE' or set namedExport: false in plugin options.Use default import: import plainText from 'vite-plugin-plain-text'
No dependency data recorded yet.