0.1.9 • Published 2 months ago

vite-plugin-map-cdn v0.1.9

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

vite-plugin-cdn-map

Use native browser import-maps in vite for CDN resolution. What's import-maps

This plugin by default tries to resolve all dependencies as CDN libraries.

NPM

Usage

Simply add CDN plugin in vite.config

// vite.config.ts
const { defineConfig } = require('vite')
import cdn from 'vite-plugin-map-cdn'

export default defineConfig({
  plugins: [
    cdn({cdn: "unpkg.sh"})
  ],
})

Then your module will import from cdn instead of vite pre-bundling it.

Because this solution uses native import-maps, itt also allow you to use module in runtime:

<!-- index.html -->
<script type="module">
  import _, { isNaN } from 'lodash'

  console.log(_.isNaN(NaN)) // true
  console.log(isNaN(NaN)) // true
</script>

License

MIT

0.1.9

2 months ago

0.1.8

2 months ago

0.1.7

2 months ago

0.1.6

2 months ago

0.1.5

2 months ago

0.1.4

2 months ago

0.1.3

2 months ago

0.1.2

2 months ago

0.1.1

2 months ago

0.1.0

2 months ago