@cspell/dynamic-import
Advanced tools
Comparing version 6.26.0 to 6.26.1
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "6.26.0", | ||
"version": "6.26.1", | ||
"description": "Dynamic Module Loader", | ||
@@ -60,3 +60,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "a72f603f4f1afbe237f938b1a23d7cbe2a07d86f" | ||
"gitHead": "675e091816f61ce767c7f9b193ea1384313c8da2" | ||
} |
@@ -13,8 +13,32 @@ # `@cspell/dynamic-import` | ||
**TypeScript** | ||
### Example ESM Package | ||
Example loading [chalk v5](https://www.npmjs.com/package/chalk) which is an ESM only module. | ||
**TypeScript Common JS** | ||
```ts | ||
import { dynamicImport } from '@cspell/dynamic-import'; | ||
const pChalk = dynamicImport<typeof import('chalk')>('chalk', __dirname); | ||
``` | ||
**TypeScript ESM** | ||
```ts | ||
import { dynamicImport } from '@cspell/dynamic-import'; | ||
const pChalk = dynamicImport<typeof import('chalk')>('chalk', import.meta.url); | ||
``` | ||
### Example ESM files | ||
**TypeScript Common JS** | ||
```ts | ||
import { dynamicImport } from '@cspell/dynamic-import'; | ||
const pIndex = dynamicImport<typeof import('../esm/index.mjs')>('../esm/index.mjs', __dirname); | ||
``` | ||
<!--- @@inject: ../../static/footer.md ---> | ||
@@ -33,1 +57,3 @@ | ||
<!--- @@inject-end: ../../static/footer.md ---> | ||
<!--- cspell:dictionaries typescript ---> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8304
58
9