unplugin-legacy
v0.2.0
Published
A universal bundler plugin which adds export declarations to legacy non-module scripts.
Downloads
5
Maintainers
Readme
unplugin-legacy
🍣 A universal bundler plugin which adds export declarations to legacy non-module scripts.
Install
npm i unplugin-legacy
// vite.config.ts
import UnpluginLegacy from 'unplugin-legacy/vite'
export default defineConfig({
plugins: [
UnpluginLegacy({
/* options */
}),
],
})
Example: playground/
// rollup.config.js
import UnpluginLegacy from 'unplugin-legacy/rollup'
export default {
plugins: [
UnpluginLegacy({
/* options */
}),
],
}
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-legacy/webpack')({
/* options */
}),
],
}
// nuxt.config.js
export default defineNuxtConfig({
modules: [
[
'unplugin-legacy/nuxt',
{
/* options */
},
],
],
})
This module works for both Nuxt 2 and Nuxt Vite
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-legacy/webpack')({
/* options */
}),
],
},
}
// esbuild.config.js
import { build } from 'esbuild'
import UnpluginLegacy from 'unplugin-legacy/esbuild'
build({
plugins: [UnpluginLegacy()],
})
Usage
Options
For all options please refer to docs.
This plugin accepts all @rollup/plugin-legacy options.