Skip to content

lemonfog/unplugin-esm-cdn

Repository files navigation

unplugin-esm-cdn

NPM version

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
// vite.config.ts
import esmCdn from 'unplugin-esm-cdn/vite'

export default defineConfig({
  plugins: [
    esmCdn({ /* options */ }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import esmCdn from 'unplugin-esm-cdn/rollup'

export default {
  plugins: [
    esmCdn({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-esm-cdn/webpack')({ /* options */ })
  ]
}


Nuxt
// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['unplugin-esm-cdn/nuxt', { /* options */ }],
  ],
})

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-esm-cdn/webpack')({ /* options */ }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import esmCdn from 'unplugin-esm-cdn/esbuild'

build({
  plugins: [esmCdn()],
})


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published