unplugin-dsv
🍣 A universal bundler plugin which converts .csv
and .tsv
files into JavaScript modules with d3-dsv.
Install
npm i unplugin-dsv
Vite
// vite.config.ts
import UnpluginDsv from 'unplugin-dsv/vite'
export default defineConfig({
plugins: [
UnpluginDsv({ /* options */ }),
],
})
Example: playground/
Rollup
// rollup.config.js
import UnpluginDsv from 'unplugin-dsv/rollup'
export default {
plugins: [
UnpluginDsv({ /* options */ }),
],
}
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-dsv/webpack')({ /* options */ })
]
}
Nuxt
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-dsv/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
Vue CLI
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-dsv/webpack')({ /* options */ }),
],
},
}
esbuild
// 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"
]
}
}