0.2.1 • Published 11 months ago

unplugin-image v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

unplugin-image

NPM version

šŸ£ 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.

0.2.1

11 months ago

0.2.0

11 months ago