From 9c5c0d48bfb8c8a30182ea9117f582dd78d8bf59 Mon Sep 17 00:00:00 2001 From: waleed Date: Sun, 28 Jun 2026 23:30:49 -0700 Subject: [PATCH] fix(emcn): repair app-wide crash and unstyled UI after package extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two regressions from moving emcn into @sim/emcn: 1. optimizePackageImports['@sim/emcn'] rewrote barrel imports to direct subpaths, duplicating the toast module so ToastProvider (layout) and useToast (workspace permissions provider) resolved different ToastContext objects — useToast threw 'must be used within ' on every workspace route. Removed @sim/emcn from optimizePackageImports. 2. emcn's source left apps/sim's Tailwind content globs (and docs' v4 auto-content scope, which excludes node_modules), so utility classes used only inside emcn components stopped generating and components rendered unstyled. Added the package to apps/sim's Tailwind content and a @source to docs. --- apps/docs/app/global.css | 1 + apps/sim/next.config.ts | 1 - apps/sim/tailwind.config.ts | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/docs/app/global.css b/apps/docs/app/global.css index 3ce55e3cf48..91d2433c7c6 100644 --- a/apps/docs/app/global.css +++ b/apps/docs/app/global.css @@ -2,6 +2,7 @@ @import "fumadocs-ui/css/neutral.css"; @import "fumadocs-ui/css/preset.css"; @import "fumadocs-openapi/css/preset.css"; +@source "../../../packages/emcn/src"; /* Prevent overscroll bounce effect on the page */ html, diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 187fc0914e2..ee86254525e 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -133,7 +133,6 @@ const nextConfig: NextConfig = { optimizeCss: true, preloadEntriesOnStart: false, optimizePackageImports: [ - '@sim/emcn', 'lodash', 'framer-motion', 'reactflow', diff --git a/apps/sim/tailwind.config.ts b/apps/sim/tailwind.config.ts index fd60c537e2f..cd978e7c068 100644 --- a/apps/sim/tailwind.config.ts +++ b/apps/sim/tailwind.config.ts @@ -6,6 +6,7 @@ export default { './pages/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}', + '../../packages/emcn/src/**/*.{js,ts,jsx,tsx}', '!./app/node_modules/**', '!**/node_modules/**', ],