unplugin-esm-cdn
v0.1.4
Published
[![NPM version](https://img.shields.io/npm/v/unplugin-esm-cdn?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-esm-cdn)
Downloads
23
Maintainers
Readme
unplugin-esm-cdn
build plugin
Usage
esmCdn({
sleep:1000, // Waiting for module collection, may have a higher value
cdn:'npmmirror',
modules:['vue','vue-router'],
})
Install
npm i unplugin-esm-cdn -d
// vite.config.ts
import esmCdn from 'unplugin-esm-cdn/vite'
export default defineConfig({
plugins: [
esmCdn({ /* options */ }),
],
})
Example: playground/
// rollup.config.js
import esmCdn from 'unplugin-esm-cdn/rollup'
export default {
plugins: [
esmCdn({ /* options */ }),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-esm-cdn/webpack')({ /* options */ })
]
}
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-esm-cdn/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-esm-cdn/webpack')({ /* options */ }),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import esmCdn from 'unplugin-esm-cdn/esbuild'
build({
plugins: [esmCdn()],
})