unplugin-globals
v0.0.2
Published
Make external deps to globally
Downloads
10
Readme
unplugin-globals
Transform external imports into global variables for vite
、rollup
、esbuild
、webpack
and other bundlers.
Install
pnpm i unplugin-globals -D
yarn add unplugin-globals -D
npm i unplugin-globals -D
Usage with webpack
// webpack.config.js
import Globals from 'unplugin-globals/webpack'
export default {
plugins: [
Globals({
vue: 'Vue'
})
]
}
Usage with rollup
import { rollup } from 'rollup'
import Globals from 'unplugin-globals/rollup'
rollup({
plugins: [
globals({
vue: 'Vue'
})
]
})
Usage with vite
// vite.config.ts
import { defineConfig } from 'vite'
import Globals from 'unplugin-globals/vite'
export default defineConfig({
plugins: [
Globals({
vue: 'Vue'
})
]
})
Usage with esbuild
import { build } from 'esbuild'
import Globals from 'unplugin-globals/esbuild'
build({
plugins: [
Globals({
vue: 'Vue'
})
]
})