vite-require-main
v0.0.6
Published
Like Webpack's require
Downloads
3
Maintainers
Readme
vite-require-main
Like Webpack's require
such as:
<img :src="require(`assets/img/home/svg/icon-usr${iconName}.svg`)" alt />
📦 Out of the box
Install
npm i vite-require-main -D
Usage
import { viteRequire } from 'vite-require-main'
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
}
}
Credits
Thanks to: vite-require