unplugin-raw
v0.2.3
Published
Transform file to a default-export string.
Downloads
493
Readme
unplugin-raw
Transform file to a default-export string. It will be transformed to JavaScript, then a string.
Installation
npm i -D unplugin-raw
// vite.config.ts
import Raw from 'unplugin-raw/vite'
export default defineConfig({
plugins: [Raw()],
})
// rollup.config.js
import Raw from 'unplugin-raw/rollup'
export default {
plugins: [Raw()],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [require('unplugin-raw/esbuild')()],
})
Usage
import text from './ts.ts?raw'
import text2 from './js.js?raw'
import text3 from './jsx.jsx?raw'