@reejs/imports v2.12.1
Using Ree.js Import Helpers
Install the package:
npm i @reejs/imports
Importing
import { dynamicImport, NativeImport, URLImport } from "@reejs/imports";
let fs = await NativeImport("node:fs");
let React = await URLImport("https://esm.sh/react?target=node&bundle");
//use them in your project!
Fixing the problems with a normal dynamic import
Did you realise there's a new variable called default
in a dynamically imported module via await import
?
You can make that imported module act as if it was imported statically by this way:
let path = dynamicImport(await import("node:path"));
//use path as if it was imported as: import path from "node:path"
Please note: NativeImport
& URLImport
functions uses dynamicImport
under the hood to improve your DX.
You can even use this package in Deno as we provide full runtime compability (till an extent it's possible, for instance, we can't provide support for Deno.http
as no polyfills are created for Nodejs)
Supported Runtimes:
- Nodejs
- Deno
- Bun
- Browser (native imports currently not supported)
Found or having any problems? Head over to our repository at https://github.com/rovelstars/reejs or discuss with us over discord at: https://dscrdly.com/server
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago