Support commonJS to esm in vite
npm install @originjs/vite-plugin-commonjs --save-dev
or
yarn add @originjs/vite-plugin-commonjs --dev
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
export default {
plugins: [
viteCommonjs()
]
}
-
exclude: string[]
Dependencies to exclude from transform. -
include: string[]
Dependencies that only need to be transform.
import { esbuildCommonjs } from '@originjs/vite-plugin-commonjs'
export default {
optimizeDeps:{
esbuildOptions:{
plugins:[
esbuildCommonjs(['react-calendar','react-date-picker'])
]
}
}
}
include: string[]
Dependent modules need to be transform.