unplugin-image
A universal bundler plugin which imports JPG, PNG, GIF, SVG, and WebP files.
40,041
1
| Install | |
|---|---|
npm install unplugin-image |
|
| Latest Version: | 0.2.1 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Aug 12, 2024 |
| Links: | GitHub · npm |
Maintainer: wzc520pyfm
unplugin-image
🍣 A universal bundler plugin which imports JPG, PNG, GIF, SVG, and WebP files.
Install
npm i -D unplugin-image
// vite.config.ts
import UnpluginImage from 'unplugin-image/vite'
export default defineConfig({
plugins: [
{
...UnpluginImage({ /* options */ }),
enforce: 'pre',
},
],
})
Example: playground/
// rollup.config.js
import UnpluginImage from 'unplugin-image/rollup'
export default {
plugins: [
UnpluginImage({ /* options */ }),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-image/webpack')({ /* options */ })
]
}
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-image/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-image/webpack')({ /* options */ }),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import UnpluginImage from 'unplugin-image/esbuild'
build({
plugins: [UnpluginImage()],
})
Usage
Options
For all options please refer to docs.
This plugin accepts all @rollup/plugin-image options.
Related Packages
@phosphor-icons/unplugin
[!WARNING] > This plugin is extremely experimental, and is subject to change. Us...
8,436
5
Version History
| Version | Released | License |
|---|---|---|
| 0.2.1 | MIT | |
| 0.2.0 | MIT |