Skip to content

Commit

Permalink
fix: ignore errors from cjs to esm conversion (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey authored Apr 17, 2024
1 parent 6825949 commit 68b6cc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/many-beans-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/vite": patch
---

Ignore errors caused by cjs => esm conversion
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,11 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
if (!isBuild) {
const ext = path.extname(id);
if (ext === ".cjs" || (ext === ".js" && isCJSModule(id))) {
return cjsToEsm(source);
try {
return await cjsToEsm(source);
} catch {
return null;
}
}
}

Expand Down

0 comments on commit 68b6cc3

Please sign in to comment.