Skip to content

Commit

Permalink
fix: load translator with require when checking tags API (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
rturnq authored Dec 14, 2024
1 parent 955b717 commit 9ac0c90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-schools-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/vite": patch
---

Fix loading of translator when checking if tags API is being used"
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import anyMatch from "anymatch";
import crypto from "crypto";
import glob from "fast-glob";
import fs from "fs";
import { createRequire } from "module";
import path from "path";
import { pathToFileURL } from "url";
import type * as vite from "vite";
Expand Down Expand Up @@ -661,8 +662,8 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
tagsAPI = false;
} else {
try {
tagsAPI =
(await import(translatorPackage)).preferAPI !== "class";
const require = createRequire(import.meta.url);
tagsAPI = require(translatorPackage).preferAPI !== "class";
} catch {
tagsAPI = true;
}
Expand Down

0 comments on commit 9ac0c90

Please sign in to comment.