-
Notifications
You must be signed in to change notification settings - Fork 12k
feat: optimize webpack bundling to reduce server chunk duplication #23437
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
Changes from all commits
7f417dd
2ad75e2
9a83c1e
9d42a79
9d1318c
018f8ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainBlock 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/**' -SLength 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/**' -SLength of output: 656 Convert blocked namespace imports before merging 🤖 Prompt for AI Agents |
||
| lodash: { | ||
| transform: "lodash/{{member}}", | ||
| }, | ||
|
|
@@ -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( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.