Skip to content
97 changes: 97 additions & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,71 @@ const nextConfig = (phase) => {
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/flags": {
transform: "@calcom/features/flags/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/users": {
transform: "@calcom/features/users/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/watchlist": {
transform: "@calcom/features/watchlist/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/calendar-cache": {
transform: "@calcom/features/calendar-cache/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/platform-oauth-client": {
transform: "@calcom/features/platform-oauth-client/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/lib/server/repository": {
transform: "@calcom/lib/server/repository/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/eventtypes/components": {
transform: "@calcom/features/eventtypes/components/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/insights/components": {
transform: "@calcom/features/insights/components/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/features/webhooks/components": {
transform: "@calcom/features/webhooks/components/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/lib/server": {
transform: "@calcom/lib/server/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/lib/hooks": {
transform: "@calcom/lib/hooks/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/lib": {
transform: "@calcom/lib/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
"@calcom/app-store": {
transform: "@calcom/app-store/{{member}}",
skipDefaultConversion: true,
preventFullImport: true,
},
Comment on lines +229 to +293
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Block full/default imports now; scan repo for offenders and auto-fix

preventFullImport + skipDefaultConversion will break default/namespace imports from these packages. Run a quick scan and codemod before merging.

I can generate a jscodeshift to convert default/namespace imports to named imports if you want.


🏁 Script executed:

#!/bin/bash
# Find default or namespace imports from modularized sources
PKGS='@calcom/features/(flags|users|watchlist|calendar-cache|platform-oauth-client|eventtypes/components|insights/components|webhooks/components)|@calcom/lib(/server/repository|/server|/hooks)?|@calcom/app-store'
rg -nP --type=ts --type=tsx --type=js --type=jsx \
  "import\s+(?!\{\s*[^}]+\s*\})[^;]+from\s+\"($PKGS)\"" \
  -g '!**/node_modules/**' -S

Length of output: 573


🏁 Script executed:

#!/bin/bash
# Re-run search including TSX by defining file types explicitly
PKGS='@calcom/features/(flags|users|watchlist|calendar-cache|platform-oauth-client|eventtypes/components|insights/components|webhooks/components)|@calcom/lib(/server/repository|/server|/hooks)?|@calcom/app-store'
rg --type-add 'tsx:*.tsx' -nP \
  "import\s+(?!\{\s*[^}]+\s*\})[^;]+from\s+\"($PKGS)\"" \
  -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' -g '!**/node_modules/**' -S

Length of output: 656


Convert blocked namespace imports before merging
– tests/libs/mocks/app-store.ts:4 uses import type * as appStore from "@calcom/app-store"; this namespace import will break under preventFullImport. Update to explicit named imports or adjust the mock accordingly.

🤖 Prompt for AI Agents
In apps/web/next.config.js around lines 229-293 the module rule sets
preventFullImport for "@calcom/app-store", but tests/libs/__mocks__/app-store.ts
currently does "import type * as appStore from '@calcom/app-store'", which will
break the transform; open tests/libs/__mocks__/app-store.ts and replace the
namespace import with explicit named imports (or named type imports) that match
the actual exports from @calcom/app-store (e.g. import type { X, Y } from
"@calcom/app-store" or import { x, y } from "@calcom/app-store"); alternatively,
if changing the mock is undesirable, remove or adjust the preventFullImport
setting for "@calcom/app-store" in next.config.js so namespace imports remain
allowed—pick one approach and update the code accordingly, ensuring tests import
only the exported members.

lodash: {
transform: "lodash/{{member}}",
},
Expand All @@ -242,6 +307,38 @@ const nextConfig = (phase) => {
}
}

config.optimization = {
...config.optimization,
usedExports: true,
splitChunks: {
...config.optimization.splitChunks,
cacheGroups: {
...config.optimization.splitChunks?.cacheGroups,
repositories: {
test: /[\\/](?:packages|node_modules[\\/]@calcom)[\\/].*Repository\.(t|j)sx?$/i,
name: "repositories",
chunks: "all",
priority: 30,
enforce: true,
},
features: {
test: /[\\/](?:packages|node_modules[\\/]@calcom)[\\/]features[\\/]/,
name: "features",
chunks: "all",
priority: 25,
enforce: true,
},
prisma: {
test: /[\\/]packages[\\/]prisma[\\/]|[\\/]node_modules[\\/]@prisma[\\/]/,
name: "prisma",
chunks: "all",
priority: 20,
enforce: true,
},
},
},
};

if (isServer) {
// Module not found fix @see https://github.com/boxyhq/jackson/issues/1535#issuecomment-1704381612
config.plugins.push(
Expand Down
1 change: 0 additions & 1 deletion packages/features/insights/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export { BookingStatusBadge } from "./BookingStatusBadge";
export { CellWithOverflowX } from "./CellWithOverflowX";
export { ChartCard } from "./ChartCard";
export { KPICard } from "./KPICard";
export { LineChart } from "./LineChart";
export { LoadingInsight } from "./LoadingInsights";
export { ResponseValueCell } from "./ResponseValueCell";
export { UserStatsTable } from "./UserStatsTable";
Loading