Skip to content

Fix build issues #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: fix build issues
  • Loading branch information
raheeliftikhar5 committed Dec 7, 2023
commit 2f4504fe63685e3d38c7f1a2ac443196b250e4f5
8 changes: 4 additions & 4 deletions client/packages/lowcoder/src/base/codeEditor/autoFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import { format as formatSQL } from "sql-formatter";
import { Language } from "./codeEditorTypes";

export async function cssFormatter(text: string) {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserPlugin = await require("prettier/parser-postcss");
return (await prettier.format(text, { parser: "css", plugins: [parserPlugin], semi: false })).trim();
}

export async function htmlFormatter(text: string) {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserPlugin = await require("prettier/parser-html");
return (await prettier.format(text, { parser: "html", plugins: [parserPlugin], semi: false })).trim();
}

async function getJavascriptFormatter() {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserBabel = await require("prettier/parser-babel");
return async (text: string) =>
(await prettier.format(text, { parser: "babel", plugins: [parserBabel], semi: false })).trim();
}

export async function getJsonFormatter() {
const prettier = await import("prettier/standalone");
const prettier = await require("prettier/standalone");
const parserBabel = await require("prettier/parser-babel");
return async (text: string) => (await prettier.format(text, { parser: "json", plugins: [parserBabel] })).trim();
}
Expand Down