unplugin-import-bin
v0.1.4
Published
Import binary file as array buffer.
Downloads
22
Maintainers
Readme
unplugin-import-bin
Import binary file as array buffer.
Usage
import buffer from './path/to/file?bin'
console.log(buffer) // => Uint8Array[...]
Install
npm i unplugin-import-bin
// vite.config.ts
import ImportBin from 'unplugin-import-bin/vite'
export default defineConfig({
plugins: [
ImportBin({ /* options */ }),
],
})
Example: playground/
// rollup.config.js
import ImportBin from 'unplugin-import-bin/rollup'
export default {
plugins: [
ImportBin({ /* options */ }),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-import-bin/webpack')({ /* options */ })
]
}
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-import-bin/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-import-bin/webpack')({ /* options */ }),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import ImportBin from 'unplugin-import-bin/esbuild'
build({
plugins: [ImportBin()],
})