Skip to content

The open alternative to Salesforce, designed for AI.

Share frontend vendor and shim build helpers (#28855)

Weiko2c9a047d2d5b
diff --git a/packages/twenty-cli/src/app/bundles/build-application.ts b/packages/twenty-cli/src/app/bundles/build-application.ts
index b2ac2494376..9081a3ebff4 100644
--- a/packages/twenty-cli/src/app/bundles/build-application.ts
+++ b/packages/twenty-cli/src/app/bundles/build-application.ts
@@ -22,7 +22,7 @@ import { getFrontComponentBuildPlugins } from '@/app/bundles/front-component-bui
import { createStubTwentySdkDefinePlugin } from '@/app/bundles/plugins/stub-twenty-sdk-define.plugin';
import { type OnFileBuiltCallback } from '@/app/bundles/types/on-file-built-callback.type';
import { buildSharedDependenciesBundle } from '@/app/bundles/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle';
-import { type SharedDependenciesBuildContext } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';
+import { type SharedDependenciesBuildContext } from 'twenty-shared/front-component-build';
import { type EntityFilePaths } from '@/app/manifest/types/entity-file-paths.type';
import { loadFrontComponentTranslationCatalogs } from '@/app/translations/load-front-component-translation-catalogs';
import { emptyDir, ensureDir, pathExists } from '@/app/fs-utils';
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts
index 1bbcfa87524..bd1c6efb968 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/__tests__/enumerate-shared-dependencies-export-names.spec.ts
@@ -3,11 +3,14 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
import * as esbuild from 'esbuild';
-import { getSharedDependenciesEntrySource } from '../utils/get-shared-dependencies-entry-source';
-import { getSharedDependenciesShimSource } from '../utils/get-shared-dependencies-shim-source';
+import {
+ getSharedDependenciesEntrySource,
+ getSharedDependenciesShimSource,
+} from 'twenty-shared/front-component-build';
import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';
import { describe, expect, it } from 'vitest';
+import { getFrontComponentBuildPlugins } from '@/app/bundles/front-component-build/utils/get-front-component-build-plugins';
import { MINIMAL_APP_PATH } from '@/app/__tests__/utils/fixture-paths';
import { enumerateSharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names';
@@ -122,10 +125,22 @@ describe('enumerateSharedDependenciesExportNames', () => {
format: 'esm',
outfile: bundlePath,
});
- const shim = getSharedDependenciesShimSource({
- specifier,
- exportNames: names,
- }).replaceAll(
+ const component = await esbuild.build({
+ stdin: {
+ contents: `export { count, increment } from ${JSON.stringify(specifier)};`,
+ resolveDir: appPath,
+ },
+ bundle: true,
+ format: 'esm',
+ write: false,
+ external: [FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER],
+ plugins: getFrontComponentBuildPlugins({
+ getSharedDependenciesBuildContext: () => ({
+ exportNamesBySpecifier: new Map([[specifier, names]]),
+ }),
+ }),
+ });
+ const shim = component.outputFiles[0].text.replaceAll(
FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER,
pathToFileURL(bundlePath).href,
);
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts
index 547df97ed45..b972223febf 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/build-shared-dependencies-bundle.ts
@@ -1,9 +1,11 @@
import { getWatchInputPlugins } from '@/app/dev/collect-watch-inputs';
import { getBaseFrontComponentBuildOptions } from '@/app/bundles/front-component-build/utils/get-base-front-component-build-options';
import { type OnFileBuiltCallback } from '@/app/bundles/types/on-file-built-callback.type';
-import { type SharedDependenciesBuildContext } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';
+import {
+ getSharedDependenciesEntrySource,
+ type SharedDependenciesBuildContext,
+} from 'twenty-shared/front-component-build';
import { enumerateSharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names';
-import { getSharedDependenciesEntrySource } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source';
import { getSharedDependenciesNamespaceCollisions } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions';
import { ensureDir } from '@/app/fs-utils';
import crypto from 'crypto';
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts
deleted file mode 100644
index cf5dff1376f..00000000000
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { type SharedDependenciesBuildContext } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';
-import { getSharedDependenciesShimSource } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source';
-import type * as esbuild from 'esbuild';
-import { isDefined } from 'twenty-shared/utils';
-
-const SHARED_DEPENDENCIES_SHIM_NAMESPACE = 'twenty-shared-dependencies-shim';
-
-export const createSharedDependenciesShimPlugin = (
- getSharedDependenciesBuildContext: () => SharedDependenciesBuildContext | null,
-): esbuild.Plugin => ({
- name: 'twenty-shared-dependencies-shim',
- setup: (build) => {
- build.onResolve({ filter: /.*/ }, ({ path: specifier }) => {
- const sharedDependenciesBuildContext =
- getSharedDependenciesBuildContext();
-
- if (!isDefined(sharedDependenciesBuildContext)) {
- return undefined;
- }
-
- if (
- !sharedDependenciesBuildContext.exportNamesBySpecifier.has(specifier)
- ) {
- return undefined;
- }
-
- return { path: specifier, namespace: SHARED_DEPENDENCIES_SHIM_NAMESPACE };
- });
-
- build.onLoad(
- { filter: /.*/, namespace: SHARED_DEPENDENCIES_SHIM_NAMESPACE },
- ({ path: specifier }) => {
- const exportNames =
- getSharedDependenciesBuildContext()?.exportNamesBySpecifier.get(
- specifier,
- );
-
- if (!isDefined(exportNames)) {
- return undefined;
- }
-
- return {
- contents: getSharedDependenciesShimSource({ specifier, exportNames }),
- loader: 'js' as const,
- };
- },
- );
- },
-});
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts
deleted file mode 100644
index af7c97c295d..00000000000
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { type SharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';
-
-export type SharedDependenciesBuildContext = {
- exportNamesBySpecifier: Map<string, SharedDependenciesExportNames>;
-};
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts
index da9ee4206af..483053a996d 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/enumerate-shared-dependencies-export-names.ts
@@ -8,7 +8,7 @@ import { isDefined } from 'twenty-shared/utils';
import { getWatchInputPlugins } from '@/app/dev/collect-watch-inputs';
import { getBaseFrontComponentBuildOptions } from '@/app/bundles/front-component-build/utils/get-base-front-component-build-options';
-import { type SharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';
+import { type SharedDependenciesExportNames } from 'twenty-shared/front-component-build';
export const enumerateSharedDependenciesExportNames = async ({
appPath,
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts
index 675e4823f27..5745b73bba4 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-namespace-collisions.ts
@@ -1,4 +1,4 @@
-import { toSharedDependenciesNamespaceIdentifier } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';
+import { toSharedDependenciesNamespaceIdentifier } from 'twenty-shared/front-component-build';
export const getSharedDependenciesNamespaceCollisions = (
dependencies: string[],
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-base-front-component-build-options.ts b/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-base-front-component-build-options.ts
index 9a5f9976d7b..ed2120c5b23 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-base-front-component-build-options.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-base-front-component-build-options.ts
@@ -1,19 +1,14 @@
import type * as esbuild from 'esbuild';
+import { getCommonFrontComponentBuildOptions } from 'twenty-shared/front-component-build';
import { FRONT_COMPONENT_EXTERNAL_MODULES } from '../constants/front-component-external-modules';
import { getFrontComponentBuildPlugins } from './get-front-component-build-plugins';
export const getBaseFrontComponentBuildOptions = (): esbuild.BuildOptions => ({
- bundle: true,
- splitting: false,
- format: 'esm',
+ ...getCommonFrontComponentBuildOptions(),
outExtension: { '.js': '.mjs' },
external: FRONT_COMPONENT_EXTERNAL_MODULES,
- jsx: 'automatic',
sourcemap: true,
metafile: true,
- logLevel: 'silent',
- minify: true,
- define: { 'process.env.NODE_ENV': '"production"' },
plugins: [...getFrontComponentBuildPlugins()],
});
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-front-component-build-plugins.ts b/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-front-component-build-plugins.ts
index 1ebe17bff41..52e5b1fc8cb 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-front-component-build-plugins.ts
+++ b/packages/twenty-cli/src/app/bundles/front-component-build/utils/get-front-component-build-plugins.ts
@@ -1,9 +1,11 @@
import type * as esbuild from 'esbuild';
-import { createJsxRuntimeRemoteWrapperPlugin } from 'twenty-shared/front-component-build';
+import {
+ createJsxRuntimeRemoteWrapperPlugin,
+ createSharedDependenciesShimPlugin,
+ type SharedDependenciesBuildContext,
+} from 'twenty-shared/front-component-build';
import { isDefined } from 'twenty-shared/utils';
-import { createSharedDependenciesShimPlugin } from '@/app/bundles/front-component-build/shared-dependencies-build/create-shared-dependencies-shim-plugin';
-import { type SharedDependenciesBuildContext } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-build-context.type';
import { cssInjectionPlugin } from '../css-injection-plugin';
import { jsxTransformToRemoteDomWorkerFormatPlugin } from '../jsx-transform-to-remote-dom-worker-format-plugin';
import { createPreactAliasPlugin } from '../preact-alias-plugin';
@@ -18,9 +20,10 @@ export const getFrontComponentBuildPlugins = (
): esbuild.Plugin[] => [
...(isDefined(options?.getSharedDependenciesBuildContext)
? [
- createSharedDependenciesShimPlugin(
- options.getSharedDependenciesBuildContext,
- ),
+ createSharedDependenciesShimPlugin({
+ getSharedDependenciesBuildContext:
+ options.getSharedDependenciesBuildContext,
+ }),
]
: []),
createJsxRuntimeRemoteWrapperPlugin(
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts b/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts
deleted file mode 100644
index ece061905cc..00000000000
--- a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export type SharedDependenciesExportNames = {
- namedExports: string[];
- hasDefaultExport: boolean;
-};
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts b/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts
deleted file mode 100644
index 9badf56abc4..00000000000
--- a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type SharedDependenciesExportNames } from '@/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-export-names.type';
-import { toSharedDependenciesNamespaceIdentifier } from '@/front-component-renderer/build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';
-import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';
-
-export const getSharedDependenciesShimSource = ({
- specifier,
- exportNames,
-}: {
- specifier: string;
- exportNames: SharedDependenciesExportNames;
-}): string => {
- const namespaceIdentifier =
- toSharedDependenciesNamespaceIdentifier(specifier);
-
- const lines = [
- `import { ${namespaceIdentifier} } from ${JSON.stringify(FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER)};`,
- ];
-
- for (const [index, exportName] of exportNames.namedExports.entries()) {
- lines.push(
- `const __sharedDependenciesExport${index} = ${namespaceIdentifier}[${JSON.stringify(exportName)}];`,
- `export { __sharedDependenciesExport${index} as ${JSON.stringify(exportName)} };`,
- );
- }
-
- if (exportNames.hasDefaultExport) {
- lines.push(`export default ${namespaceIdentifier}.default;`);
- }
-
- return lines.join('\n');
-};
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts b/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts
deleted file mode 100644
index 055d6f064ec..00000000000
--- a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const toSharedDependenciesNamespaceIdentifier = (
- specifier: string,
-): string =>
- `__shared_dependencies_${specifier.replace(/[^A-Za-z0-9]/g, '_')}__`;
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/utils/get-front-component-build-plugins.ts b/packages/twenty-sdk/src/front-component-renderer/build/utils/get-front-component-build-plugins.ts
index 7191f6f347d..765e680e154 100644
--- a/packages/twenty-sdk/src/front-component-renderer/build/utils/get-front-component-build-plugins.ts
+++ b/packages/twenty-sdk/src/front-component-renderer/build/utils/get-front-component-build-plugins.ts
@@ -1,9 +1,11 @@
import type * as esbuild from 'esbuild';
-import { createJsxRuntimeRemoteWrapperPlugin } from 'twenty-shared/front-component-build';
+import {
+ createJsxRuntimeRemoteWrapperPlugin,
+ createSharedDependenciesShimPlugin,
+ type SharedDependenciesBuildContext,
+} from 'twenty-shared/front-component-build';
import { isDefined } from 'twenty-shared/utils';
-import { createSharedDependenciesShimPlugin } from '@/front-component-renderer/build/shared-dependencies-build/create-shared-dependencies-shim-plugin';
-import { type SharedDependenciesBuildContext } from '@/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-build-context.type';
import { cssInjectionPlugin } from '../css-injection-plugin';
import { jsxTransformToRemoteDomWorkerFormatPlugin } from '../jsx-transform-to-remote-dom-worker-format-plugin';
import { createPreactAliasPlugin } from '../preact-alias-plugin';
@@ -19,9 +21,10 @@ export const getFrontComponentBuildPlugins = (
): esbuild.Plugin[] => [
...(isDefined(options?.getSharedDependenciesBuildContext)
? [
- createSharedDependenciesShimPlugin(
- options.getSharedDependenciesBuildContext,
- ),
+ createSharedDependenciesShimPlugin({
+ getSharedDependenciesBuildContext:
+ options.getSharedDependenciesBuildContext,
+ }),
]
: []),
createJsxRuntimeRemoteWrapperPlugin(
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts b/packages/twenty-shared/src/front-component-build/create-shared-dependencies-shim-plugin.ts
similarity index 80%
rename from packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts
rename to packages/twenty-shared/src/front-component-build/create-shared-dependencies-shim-plugin.ts
index e475d5f4505..b5a5269b4f6 100644
--- a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/create-shared-dependencies-shim-plugin.ts
+++ b/packages/twenty-shared/src/front-component-build/create-shared-dependencies-shim-plugin.ts
@@ -1,13 +1,15 @@
-import { type SharedDependenciesBuildContext } from '@/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-build-context.type';
-import { getSharedDependenciesShimSource } from '@/front-component-renderer/build/shared-dependencies-build/utils/get-shared-dependencies-shim-source';
+import { type SharedDependenciesBuildContext } from '@/front-component-build/shared-dependencies-build-context.type';
+import { getSharedDependenciesShimSource } from '@/front-component-build/get-shared-dependencies-shim-source';
import type * as esbuild from 'esbuild';
-import { isDefined } from 'twenty-shared/utils';
+import { isDefined } from '@/utils/validation/isDefined';
const SHARED_DEPENDENCIES_SHIM_NAMESPACE = 'twenty-shared-dependencies-shim';
-export const createSharedDependenciesShimPlugin = (
- getSharedDependenciesBuildContext: () => SharedDependenciesBuildContext | null,
-): esbuild.Plugin => ({
+export const createSharedDependenciesShimPlugin = ({
+ getSharedDependenciesBuildContext,
+}: {
+ getSharedDependenciesBuildContext: () => SharedDependenciesBuildContext | null;
+}): esbuild.Plugin => ({
name: 'twenty-shared-dependencies-shim',
setup: (build) => {
build.onResolve({ filter: /.*/ }, ({ path: specifier }) => {
diff --git a/packages/twenty-shared/src/front-component-build/get-common-front-component-build-options.ts b/packages/twenty-shared/src/front-component-build/get-common-front-component-build-options.ts
new file mode 100644
index 00000000000..ff718dea162
--- /dev/null
+++ b/packages/twenty-shared/src/front-component-build/get-common-front-component-build-options.ts
@@ -0,0 +1,11 @@
+import { type BuildOptions } from 'esbuild';
+
+export const getCommonFrontComponentBuildOptions = (): BuildOptions => ({
+ bundle: true,
+ splitting: false,
+ format: 'esm',
+ jsx: 'automatic',
+ logLevel: 'silent',
+ minify: true,
+ define: { 'process.env.NODE_ENV': '"production"' },
+});
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.ts b/packages/twenty-shared/src/front-component-build/get-shared-dependencies-entry-source.ts
similarity index 69%
rename from packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.ts
rename to packages/twenty-shared/src/front-component-build/get-shared-dependencies-entry-source.ts
index f853989b96a..84571185fac 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-entry-source.ts
+++ b/packages/twenty-shared/src/front-component-build/get-shared-dependencies-entry-source.ts
@@ -1,5 +1,5 @@
-import { type SharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';
-import { toSharedDependenciesNamespaceIdentifier } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';
+import { type SharedDependenciesExportNames } from '@/front-component-build/shared-dependencies-export-names.type';
+import { toSharedDependenciesNamespaceIdentifier } from '@/front-component-build/to-shared-dependencies-namespace-identifier';
export const getSharedDependenciesEntrySource = (
exportNamesBySpecifier: Map<string, SharedDependenciesExportNames>,
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts b/packages/twenty-shared/src/front-component-build/get-shared-dependencies-shim-source.ts
similarity index 68%
rename from packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts
rename to packages/twenty-shared/src/front-component-build/get-shared-dependencies-shim-source.ts
index e1ba81986fb..aea0a31eab5 100644
--- a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/get-shared-dependencies-shim-source.ts
+++ b/packages/twenty-shared/src/front-component-build/get-shared-dependencies-shim-source.ts
@@ -1,6 +1,6 @@
-import { type SharedDependenciesExportNames } from '@/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type';
-import { toSharedDependenciesNamespaceIdentifier } from '@/app/bundles/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier';
-import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from 'twenty-shared/application';
+import { type SharedDependenciesExportNames } from '@/front-component-build/shared-dependencies-export-names.type';
+import { toSharedDependenciesNamespaceIdentifier } from '@/front-component-build/to-shared-dependencies-namespace-identifier';
+import { FRONT_COMPONENT_SHARED_DEPENDENCIES_IMPORT_SPECIFIER } from '@/application/constants/FrontComponentSharedDependenciesImportSpecifier';
export const getSharedDependenciesShimSource = ({
specifier,
diff --git a/packages/twenty-shared/src/front-component-build/index.ts b/packages/twenty-shared/src/front-component-build/index.ts
index 6c43ad3051c..ec7ea5be44a 100644
--- a/packages/twenty-shared/src/front-component-build/index.ts
+++ b/packages/twenty-shared/src/front-component-build/index.ts
@@ -7,9 +7,16 @@
* |___/
*/
+export { createSharedDependenciesShimPlugin } from './create-shared-dependencies-shim-plugin';
export {
createCssInjectionPlugin,
cssInjectionPlugin,
} from './css-injection-plugin';
+export { getCommonFrontComponentBuildOptions } from './get-common-front-component-build-options';
+export { getSharedDependenciesEntrySource } from './get-shared-dependencies-entry-source';
+export { getSharedDependenciesShimSource } from './get-shared-dependencies-shim-source';
export { createJsxRuntimeRemoteWrapperPlugin } from './jsx-runtime-remote-wrapper-plugin';
+export type { SharedDependenciesBuildContext } from './shared-dependencies-build-context.type';
+export type { SharedDependenciesExportNames } from './shared-dependencies-export-names.type';
+export { toSharedDependenciesNamespaceIdentifier } from './to-shared-dependencies-namespace-identifier';
export { unwrapDefineFrontComponentToDirectExport } from './unwrap-define-front-component-to-direct-export';
diff --git a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts b/packages/twenty-shared/src/front-component-build/shared-dependencies-build-context.type.ts
similarity index 66%
rename from packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts
rename to packages/twenty-shared/src/front-component-build/shared-dependencies-build-context.type.ts
index fc2ba6668e3..779139c877e 100644
--- a/packages/twenty-sdk/src/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-build-context.type.ts
+++ b/packages/twenty-shared/src/front-component-build/shared-dependencies-build-context.type.ts
@@ -1,4 +1,4 @@
-import { type SharedDependenciesExportNames } from '@/front-component-renderer/build/shared-dependencies-build/types/shared-dependencies-export-names.type';
+import { type SharedDependenciesExportNames } from '@/front-component-build/shared-dependencies-export-names.type';
export type SharedDependenciesBuildContext = {
exportNamesBySpecifier: Map<string, SharedDependenciesExportNames>;
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts b/packages/twenty-shared/src/front-component-build/shared-dependencies-export-names.type.ts
similarity index 100%
rename from packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/types/shared-dependencies-export-names.type.ts
rename to packages/twenty-shared/src/front-component-build/shared-dependencies-export-names.type.ts
diff --git a/packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts b/packages/twenty-shared/src/front-component-build/to-shared-dependencies-namespace-identifier.ts
similarity index 100%
rename from packages/twenty-cli/src/app/bundles/front-component-build/shared-dependencies-build/utils/to-shared-dependencies-namespace-identifier.ts
rename to packages/twenty-shared/src/front-component-build/to-shared-dependencies-namespace-identifier.ts