# @leaflink/vite-plugin-importmap

> Vite plugin to allow loading dependencies via native import maps

Latest version **1.0.3** (published 2023-10-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install @leaflink/vite-plugin-importmap
pnpm add @leaflink/vite-plugin-importmap
yarn add @leaflink/vite-plugin-importmap
bun add @leaflink/vite-plugin-importmap
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-10-19 |
| First published | 2023-10-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=14.18 |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | leaflink_admin, steviep13, packagefixes, lapski, aaron.markey, jameslyon42, brenton-cozby |
| Keywords | vite, vite-plugin, importmap |

## Links

- npm: https://www.npmjs.com/package/@leaflink/vite-plugin-importmap
- npm.io page: https://npm.io/package/@leaflink/vite-plugin-importmap

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-10-19
- 0.0.0-PR-10--8d917a7 (pr) — 2023-10-19
- 0.0.0-PR-10--77e1e2d — 2023-10-19
- 1.0.2 — 2023-10-19
- 0.0.0-PR-9--2ebd96a — 2023-10-19
- 0.0.0-PR-8--de399b2 — 2023-10-19
- 0.0.0-PR-8--8b733f2 — 2023-10-19
- 1.0.1 — 2023-10-18
- 0.0.0-PR-7--c168215 — 2023-10-18
- 0.0.0-PR-6--2a2c47c — 2023-10-18
- 1.0.0 — 2023-10-17
- 0.0.0-PR-5--0aa93be — 2023-10-17
- 0.0.0-PR-4--9719554 — 2023-10-17
- 0.0.0-PR-4--1ae70ff — 2023-10-17
- 0.0.0-PR-4--06a0cb3 — 2023-10-17
- … 8 more at https://npm.io/package/@leaflink/vite-plugin-importmap/versions

## README

# @leaflink/vite-plugin-importmap

Vite plugin to allow loading dependencies via native import maps, based on [vite-plugin-import-maps](https://github.com/pakholeung37/vite-plugin-import-maps). It does not re-alias modules on build so can support peer dependencies loaded via import maps.

## Installation

`$ npm install --save-dev @leaflink/vite-plugin-importmap`

## Basic Usage

Import and add to the plugins section in your Vite config:

```
import buildImportMap from '@leaflink/vite-plugin-importmap';

export default defineConfig(({ mode }) => {
  plugins: [
    buildImportMap({
      imports: {
        vue: 'https://unpkg.com/vue@3.3.4/dist/vue.esm-browser.js',
      }
    })
  ]
});
```

### NPM and local development

For local development, version control, and type support, you should still install modules locally as before including those loaded via importmaps. To avoid any issues in local environments, this plugin should not be loaded in development mode.

## Import Map Configuration

Import map configuration matches the importmap specification, and consist of an `imports` property that defines remote paths for imported modules, and an optional `scopes` property that allows specific routes to use different remote paths. See the [MDN importmap documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) for more details.

```
{
  imports: {
    <import name>: <path to remote>
  },
  scopes?: {
    <scope path>: {
      <import name>: <path to remote>
    }
  }
}
```

---
_Source: https://npm.io/package/@leaflink/vite-plugin-importmap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
