Package Exports
- vite-plugin-inline
- vite-plugin-inline/client
Readme
vite-plugin-inline
Inline transpiled TypeScript code as a string.
Add ?inline-ts import url suffix support for Vite.
Installation
npm i vite-plugin-inline// vite.config.ts
import { defineConfig } from 'vite';
import Inline from 'vite-plugin-inline';
export default defineConfig({
plugins: [
Inline()
]
});TypeScript support:
// env.d.ts
/// <reference path="vite-plugin-inline/client" />Usage
For example, you want to import the raw content of inline.ts which has been transpiled to JavaScript.
// inline.ts
const hello: string = 'hello'// main.ts
import code from './inline.ts?inline-ts'
console.log(code) // Print: "const hello = 'hello'"License
MIT License © 2025 XLor