Skip to content
/ import Public
forked from ayoreis/import

A dynamic imports polyfill for Deno Deploy and compiled executables

License

Notifications You must be signed in to change notification settings

luminr/import

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic import ponyfill

RepositoryRegistryDocumentation

A dynamic imports polyfill for Deno Deploy and compiled executables.

Example

Note

JSX and import maps will work if configured in deno.json[c].

Important

Use statically analyzable imports when posible to avoid unnecessary work.

import { dynamicImport } from 'https://deno.land/x/import/mod.ts';

await dynamicImport(Math.random() < 0.5 ? './foo.ts' : './bar.ts');

It also has a function to evaluate modules from strings.

import { importString } from 'https://deno.land/x/import/mod.ts';

console.log(await importString('export const foo = "bar"'));

And you can pass parameters to them.

console.log(
	await importString('console.log(foo)', { parameters: { foo: 'bar' } }),
);

🦕 Happy dynamic importing!

About

A dynamic imports polyfill for Deno Deploy and compiled executables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%