fix: vite resolution + cjs fixes (#3208)

This commit is contained in:
Marvin Hagemeister
2025-08-08 12:27:21 +02:00
committed by GitHub
parent c97e8226af
commit 9a764ae116
5 changed files with 145 additions and 8 deletions
+1 -7
View File
@@ -1,6 +1,5 @@
import type { Plugin } from "vite";
import * as babel from "@babel/core";
import { cjsPlugin } from "./commonjs.ts";
import { npmWorkaround } from "./npm_workaround.ts";
export function patches(): Plugin {
@@ -9,16 +8,11 @@ export function patches(): Plugin {
applyToEnvironment() {
return true;
},
resolveId(id) {
if (id.startsWith("deno-npm:")) {
return id.slice("deno-".length);
}
},
transform(code, id) {
const res = babel.transformSync(code, {
filename: id,
babelrc: false,
plugins: [npmWorkaround, cjsPlugin],
plugins: [npmWorkaround],
});
if (res?.code) {