mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
16 lines
410 B
JavaScript
16 lines
410 B
JavaScript
import { fileURLToPath } from "node:url";
|
|
import path from "node:path";
|
|
|
|
const srcRoot = path.resolve(
|
|
path.dirname(fileURLToPath(import.meta.url)),
|
|
"src",
|
|
);
|
|
|
|
export function resolve(specifier, context, nextResolve) {
|
|
if (specifier.startsWith("@/")) {
|
|
const resolved = `${srcRoot}/${specifier.slice(2)}.ts`;
|
|
return nextResolve(resolved, context);
|
|
}
|
|
return nextResolve(specifier, context);
|
|
}
|