0.1.9 • Published 1 year ago

vite-plugin-map-cdn v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago