unplugin-legacy
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

unplugin-legacy

NPM version

🍣 A universal bundler plugin which adds export declarations to legacy non-module scripts.

Install

npm i unplugin-legacy
Vite
// vite.config.ts
import UnpluginLegacy from 'unplugin-legacy/vite'

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

Example: playground/


Rollup
// rollup.config.js
import UnpluginLegacy from 'unplugin-legacy/rollup'

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


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


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

This module works for both Nuxt 2 and Nuxt Vite


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


esbuild
// 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.

Package Sidebar

Install

npm i unplugin-legacy

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

19.9 kB

Total Files

45

Last publish

Collaborators

  • wzc520pyfm