Skip to content

Instantly share code, notes, and snippets.

@morrelinko
morrelinko / importer.ts
Created March 13, 2025 00:40
[Playground] NodeJS features
import vm from 'node:vm'
import fse from 'fs-extra'
import { transform } from 'esbuild'
import { resolve, dirname, isAbsolute } from 'pathe'
interface TryImportOptions {
rootDir?: string
loader?: 'ts' | 'js'
define?: { [key: string]: string }
alias?: Record<string, string>