unplugin-dsv
v0.2.3
Published
🍣 A universal bundler plugin which converts `.csv` and `.tsv` files into JavaScript modules with [d3-dsv](https://github.com/d3/d3-dsv).
Downloads
4
Maintainers
Readme
unplugin-dsv
🍣 A universal bundler plugin which converts .csv
and .tsv
files into JavaScript modules with d3-dsv.
Install
npm i unplugin-dsv
// vite.config.ts
import UnpluginDsv from 'unplugin-dsv/vite'
export default defineConfig({
plugins: [
UnpluginDsv({ /* options */ }),
],
})
Example: playground/
// rollup.config.js
import UnpluginDsv from 'unplugin-dsv/rollup'
export default {
plugins: [
UnpluginDsv({ /* options */ }),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-dsv/webpack')({ /* options */ })
]
}
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-dsv/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-dsv/webpack')({ /* options */ }),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import UnpluginDsv from 'unplugin-dsv/esbuild'
build({
plugins: [UnpluginDsv()],
})
Usage
Options
For all options please refer to docs.
This plugin accepts all @rollup/plugin-dsv options.
TypeScript
If you are using TypeScript, you need to add the following to your tsconfig.json
file:
{
"compilerOptions": {
"types": [
"unplugin-dsv/dsv-types"
]
}
}