fix: Check for undefined object when resolving URL
This commit is contained in:
parent
3d3c363b94
commit
bfa12bee87
1 changed files with 8 additions and 1 deletions
|
@ -20,7 +20,14 @@ import { DeepPartial } from "lume/core/utils/object.ts";
|
||||||
import { Writer } from "lume/core/writer.ts";
|
import { Writer } from "lume/core/writer.ts";
|
||||||
import { fromFileUrl, join } from "@std/path";
|
import { fromFileUrl, join } from "@std/path";
|
||||||
|
|
||||||
const cwd = fromFileUrl(import.meta.resolve("./"));
|
const specifier = "./";
|
||||||
|
const cwdUrl = await import.meta.resolve?.(specifier);
|
||||||
|
if (!cwdUrl) {
|
||||||
|
throw new Error(
|
||||||
|
`Attempted to resolve ${specifier} but got ${cwdUrl} instead.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const cwd = fromFileUrl(cwdUrl);
|
||||||
|
|
||||||
class TestWriter implements Writer {
|
class TestWriter implements Writer {
|
||||||
savePages() {
|
savePages() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue