Skip to content

unplugin/unplugin-raw

Folders and files

NameName
Last commit message
Last commit date
Feb 25, 2025
Dec 27, 2024
Feb 6, 2025
Dec 30, 2024
Nov 30, 2023
Nov 30, 2023
Nov 30, 2023
Nov 30, 2023
Dec 30, 2024
Dec 27, 2024
Mar 11, 2025
Mar 11, 2025
Oct 29, 2024
Feb 4, 2025

Repository files navigation

unplugin-raw npm

Unit Test

Transform file to a default-export string. It will be transformed to JavaScript, then a string.

Installation

npm i -D unplugin-raw
Vite
// vite.config.ts
import Raw from 'unplugin-raw/vite'

export default defineConfig({
  plugins: [Raw()],
})


Rollup
// rollup.config.js
import Raw from 'unplugin-raw/rollup'

export default {
  plugins: [Raw()],
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-raw/esbuild')()],
})


Usage

import text from './js.js?raw'
import text2 from './jsx.jsx?raw'
import text3 from './ts.ts?raw'
import text4 from './with.js' with { type: 'text' }

Sponsors

License

MIT License © 2023-PRESENT 三咲智子