Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Keep MCP node_modules out of the shared vendor chunk (#81157)

Romeo Van Snick21024ec98452
diff --git a/rspack.main.config.js b/rspack.main.config.js
index f187afcb9f1..aa04f1aca30 100644
--- a/rspack.main.config.js
+++ b/rspack.main.config.js
@@ -297,13 +297,19 @@ const config = {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
- // The data-app iframe is isolated from main-app CSS/JS by design;
- // sharing the vendor chunk would re-link them. Keep its
- // node_modules in its own chunks.
+ // The data-app and MCP iframes are isolated from main-app CSS/JS by
+ // design; sharing the vendor chunk would re-link them. Keep their
+ // node_modules in their own chunks.
+ //
+ // For MCP that also cuts both pages. `@modelcontextprotocol/ext-apps`
+ // reaches no entry but `app-embed-mcp`, so the shared chunk was
+ // charging `app-main` for it, while the MCP page pulled down a vendor
+ // chunk built for an app it never runs.
chunks: (chunk) =>
chunk.canBeInitial() &&
chunk.name !== "data-app-vendors" &&
- chunk.name !== "app-data-app",
+ chunk.name !== "app-data-app" &&
+ chunk.name !== "app-embed-mcp",
name: "vendor",
priority: -10,
},
@@ -393,7 +399,9 @@ const config = {
new HtmlWebpackPlugin({
filename: "../../embed-mcp.html",
chunksSortMode: "manual",
- chunks: ["vendor", "styles", "app-embed-mcp"],
+ // No "vendor": the cache group above leaves this entry out of it, so a
+ // tag for it would fetch a chunk the page does not use.
+ chunks: ["styles", "app-embed-mcp"],
template: __dirname + "/resources/frontend_client/mcp_apps_template.html",
// MCP apps are rendered inside a sandboxed srcdoc iframe (about:srcdoc),