Files
twenty/packages/twenty-sdk/src/front-component-renderer/remote/mock/mock-front-component.ts
T
Charles Bochet f17cc4d190 Improve building of twenty-sdk (#17913)
## Split twenty-sdk build into separate Node and browser targets

The SDK was bundling Node.js code (CLI, SDK API) and browser code (UI
components, front-component renderer) through a single Vite config. This
caused incorrect externalization — Node builtins leaked into browser
bundles and browser-specific chunking logic applied to CLI output.

This PR splits the build into `vite.config.node.ts` and
`vite.config.browser.ts` so each target gets the right externals and
output format.

Also includes a few housekeeping renames:
- `front-component` export path → `front-component-renderer` (matches
what it actually is)
- `front-component-common` merged into `front-component-api` (was a
needless extra module)
2026-02-13 15:58:19 +01:00

52 lines
1.1 KiB
TypeScript

/* eslint-disable */
//@ts-nocheck
import React, { useEffect, useState } from 'react';
import {
HtmlButton,
HtmlDiv,
HtmlH3,
HtmlP,
} from '../generated/remote-components';
const FrontComponent = () => {
const [clickCount, setClickCount] = useState(0);
const [currentTime, setCurrentTime] = useState(
new Date().toLocaleTimeString(),
);
useEffect(() => {
const interval = setInterval(() => {
setCurrentTime(new Date().toLocaleTimeString());
}, 1000);
return () => clearInterval(interval);
}, []);
return React.createElement(
HtmlDiv,
null,
React.createElement(HtmlH3, null, 'Remote DOM front component'),
React.createElement(
HtmlP,
null,
'Rendered in a web worker and mirrored on the host.',
),
React.createElement(
HtmlButton,
{ onClick: () => setClickCount(clickCount + 1) },
'Click me',
),
React.createElement(
HtmlP,
null,
'Clicked ',
clickCount,
' time',
clickCount === 1 ? '' : 's',
),
React.createElement(HtmlP, null, 'Current time: ', currentTime),
);
};
export default React.createElement(FrontComponent);