@mb1337/vite-plugin-commonjs
v0.0.9
Published
Convert CommonJS modules to ESM.
Downloads
1
Readme
Vite Plugin CommonJS
A Vite plugin to convert CommonJS modules to ESM.
Installation
npm i @mb1337/vite-plugin-commonjs --save-dev
Usage
import { viteCommonjs } from '@mb1337/vite-plugin-commonjs'
export default {
plugins: [
viteCommonjs()
]
}
Options
exclude: string[]
Dependencies to exclude from transform.include: string[]
Dependencies that only need to be transform.
CommonJS module in node_modules
import { esbuildCommonjs } from '@mb1337/vite-plugin-commonjs'
export default {
optimizeDeps: {
esbuildOptions: {
plugins: [
esbuildCommonjs(['react-calendar', 'react-date-picker'])
]
}
}
}
Options
include: string[]
Dependent modules need to be transform.