Skip to main content
Module

x/dynamic_import_ponyfill/README.md

🐎 A ponyfill for using dynamic imports within Deno Deploy.
Go to Latest
File

🐎 Dynamic import ponyfill!

A ponyfill for using dynamic imports within Deno Deploy.

import { importModule, } from 'https://deno.land/x/dynamic_import_ponyfill@v0.1.3/mod.ts'

if (Math.random() > 0.5) {
    await importModule('./foo.ts')
} else {
    await importModule('./bar.ts')
}

This module also exports an awesome function which evaluates code from a string containing import and exports statements πŸŽ‰.

import { importString, } from 'https://deno.land/x/dynamic_import_ponyfill@v0.1.3/mod.ts'

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