JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 165679
  • Score
    100M100P100Q191287F
  • License MulanPSL2

A vite plugin that support commonjs to esm in vite

Package Exports

  • @originjs/vite-plugin-commonjs
  • @originjs/vite-plugin-commonjs/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@originjs/vite-plugin-commonjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vite-plugin-commonjs

Support commonJS to esm in vite

Install

npm install @originjs/vite-plugin-commonjs --save-dev

or

yarn add @originjs/vite-plugin-commonjs --dev

Usage

import { viteCommonjs } from '@originjs/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 '@originjs/vite-plugin-commonjs'

export default {
    optimizeDeps:{
    esbuildOptions:{
      plugins:[
        esbuildCommonjs(['react-calendar','react-date-picker']) 
      ]
    }
  }
}

Options

  • include: string[] Dependent modules need to be transform.