vite-require
v0.2.3
Published
Like Webpack's require
Downloads
40,234
Readme
vite-require
Like Webpack's require
English | 简体中文
✅ dynamic-require similar to 👉 Webpack require('./foo/' + bar)
📦 Out of the box
🔨 Work only in the vite serve
phase
Install
npm i vite-require -D
Usage
import { viteRequire } from 'vite-require'
export default {
plugins: [
viteRequire(/* options */)
]
}
API
viteRequire([options])
export interface Options {
extensions?: string[]
filter?: (id: string) => false | void
dynamic?: {
/**
* 1. `true` - Match all possibilities as much as possible, More like `webpack`
* 2. `false` - It behaves more like `@rollup/plugin-dynamic-import-vars`
* @default true
*/
loose?: boolean
}
}