Skip to content

[WIP] Reduce lowcoder-sdk initial bundle size #774

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
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
lazy load ReactPlayer + ReactMarkdown
  • Loading branch information
raheeliftikhar5 committed Mar 26, 2024
commit 3184cd32fdd0cf67a5b416380d076826a94e4208
8 changes: 5 additions & 3 deletions client/packages/lowcoder-design/src/components/audio.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { CSSProperties } from "react";
import { Ref } from "react";
import ReactPlayer from "react-player";
import { lazy, Ref } from "react";
import type {default as ReactPlayerType} from "react-player";
import styled from "styled-components";

const ReactPlayer = lazy(() => import("react-player"));

const Audio = styled(ReactPlayer)`
height: 32px !important;
`;
Expand All @@ -14,7 +16,7 @@ export function TacoAudio(props: {
onEnded?: () => void;
className?: string;
style?: CSSProperties;
audioRef?: Ref<ReactPlayer>;
audioRef?: Ref<ReactPlayerType>;
autoPlay?: boolean;
loop?: boolean;
}) {
Expand Down
7 changes: 5 additions & 2 deletions client/packages/lowcoder-design/src/components/markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { css } from "styled-components";
import ReactMarkdown from "react-markdown";
import { lazy } from "react";
// import ReactMarkdown from "react-markdown";
import rehypeRaw from "rehype-raw";
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
import remarkGfm from "remark-gfm";
import { ReactMarkdownOptions } from "react-markdown/lib/react-markdown";
import type { ReactMarkdownOptions } from "react-markdown/lib/react-markdown";

const ReactMarkdown = lazy(() => import('react-markdown'));

export const markdownCompCss = css`
.markdown-body {
Expand Down
5 changes: 4 additions & 1 deletion client/packages/lowcoder-design/src/components/video.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import ReactPlayer from "react-player";
// import ReactPlayer from "react-player";
import { lazy } from 'react';
import styled from "styled-components";
import { videoPlayTriangle } from "icons";

const ReactPlayer = lazy(() => import("react-player"));

export const Video = styled(ReactPlayer)`
height: 100% !important;
width: 100% !important;
Expand Down