Dynamic Module Loader
npm install @cspell/dynamic-import@cspell/dynamic-importA small library to assist with dynamically loading CommonJS and ESM Modules from either CommonJS or ESM Modules.
``sh`
npm install -S @cspell/dynamic-import
Example loading chalk v5 which is an ESM only module.
TypeScript Common JS
`ts
import { dynamicImport } from '@cspell/dynamic-import';
const pChalk = dynamicImport
`
TypeScript ESM
`ts
import { dynamicImport } from '@cspell/dynamic-import';
const pChalk = dynamicImport
`
TypeScript Common JS
`ts
import { dynamicImport } from '@cspell/dynamic-import';
const pIndex = dynamicImport
``
---
Brought to you by
Street Side Software