mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
fix: typescript support fix, add some params to editor, etc
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { getFileExt } from "~/lib/utils";
|
||||
import { FileSchema } from "~/server/db/schema/file";
|
||||
import { ProjectSettingsSchema } from "~/server/db/schema/project";
|
||||
import { transformJs } from "~/server/lib/transform-js";
|
||||
@@ -10,7 +11,9 @@ export const serveJs = async (
|
||||
|
||||
// transpile to es5
|
||||
if (cfg?.transpiler === "swc") {
|
||||
content = await transformJs(content);
|
||||
const ext = getFileExt(file.filename);
|
||||
const typescript = ["ts", "tsx"].includes(ext);
|
||||
content = await transformJs(content, typescript ? "ts" : "js");
|
||||
}
|
||||
|
||||
return content;
|
||||
|
||||
Reference in New Issue
Block a user