vite-plugin-uint8array

1.0.0 • Public • Published

a fast-by-default way to bundle assets as Uint8Arrays using base64

install

npm i vite-plugin-uint8array -D

usage

in vite.config.ts

import { defineConfig } from 'vite'
import uint8array from 'vite-plugin-uint8array'

export default defineConfig({
  plugins: [uint8array()]
})

in your files

import example from './example.png?uint8array'

// example is a Uint8Array
// example.buffer is an ArrayBuffer

typescript

add support for ?uint8array in module paths

{
  "compilerOptions": {
    "types": ["vite-plugin-uint8array/types"]
  }
}

hat tip

this was inspired by my original pr to vite-plugin-arraybuffer, so thanks for the foundation tachibana-shin!

Readme

Keywords

none

Package Sidebar

Install

npm i vite-plugin-uint8array

Weekly Downloads

22

Version

1.0.0

License

MIT

Unpacked Size

5.45 kB

Total Files

8

Last publish

Collaborators

  • kevlened