rollup-plugin-raw
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

npm

rollup-plugin-raw

🍣 A Rollup plugin to handler raw file.

Requirements

This plugin requires an LTS Node version (v14.0.0+) and Rollup v3.0.0+.

Install

Using pnpm:

pnpm add rollup-plugin-raw -D

Usage

Rollup Config

import { defineConfig } from "rollup";
import raw from "rollup-plugin-raw";

export default defineConfig({
  /* ... */
  plugins: [
    raw({
      filter: /\.(txt|glsl|fs)$/i,
    }),
  ],
});

test.txt Content

hello world

will transform to

export default "hello world";

JS Code

import txt from "./test.txt";

console.log(txt);

Options

filter

Type: RegExp
Required

The RegExp to match raw file.

Package Sidebar

Install

npm i rollup-plugin-raw

Weekly Downloads

9

Version

0.0.1

License

MIT

Unpacked Size

2.93 kB

Total Files

4

Last publish

Collaborators

  • simumn