https://github.com/fasttime/multi-import
Dynamically import multiple ES modules at once.
https://github.com/fasttime/multi-import
Last synced: over 1 year ago
JSON representation
Dynamically import multiple ES modules at once.
- Host: GitHub
- URL: https://github.com/fasttime/multi-import
- Owner: fasttime
- License: isc
- Created: 2022-03-22T10:38:30.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-12T11:31:28.000Z (over 3 years ago)
- Last Synced: 2025-02-09T11:48:00.324Z (over 1 year ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
# multi-import · [![npm version][npm badge]][npm URL]
Dynamically import multiple ES modules at once.
Example usage:
```js
import multiImport from 'multi-import';
export async function tsTest()
{
const [{ default: ts }, { fileURLToPath }] = await multiImport('typescript', 'url');
const fileURL = new URL('test/ts-defs-test.ts', import.meta.url);
const fileName = fileURLToPath(fileURL);
const program = ts.createProgram([fileName], { strict: true });
const diagnostics = ts.getPreEmitDiagnostics(program);
if (diagnostics.length) {
const reporter = ts.createDiagnosticReporter(ts.sys, true);
diagnostics.forEach(reporter);
}
}
```
[npm badge]: https://badge.fury.io/js/multi-import.svg
[npm URL]: https://www.npmjs.com/package/multi-import