Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions packages/xmcp/src/compiler/get-webpack-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,7 @@ export function getWebpackConfig(
path.resolve(__dirname, "../.."), // for pnpm
],
},
plugins: [
new InjectRuntimePlugin(),
new CreateTypeDefinitionPlugin(),
// Ignore @swc/core native bindings and wasm fallbacks during build
// These are externalized and loaded at runtime when React is enabled
new IgnorePlugin({
resourceRegExp: /^@swc\/core/,
contextRegExp: /ssr/,
}),
new IgnorePlugin({
resourceRegExp: /@swc\/core-(darwin|linux|win32|freebsd|android)/,
}),
new IgnorePlugin({
resourceRegExp: /swc\.(darwin|linux|win32|freebsd|android).*\.node$/,
}),
new IgnorePlugin({
resourceRegExp: /@swc\/wasm/,
}),
],
plugins: [new InjectRuntimePlugin(), new CreateTypeDefinitionPlugin()],
module: {
rules: [
{
Expand All @@ -102,19 +84,8 @@ export function getWebpackConfig(
},
},
},
{
test: /\.node$/,
loader: "node-loader",
},
],
},
ignoreWarnings: [
// Ignore warnings from @swc/core's optional native bindings
/Can't resolve '\.\/swc\./,
/Can't resolve '@swc\/core-/,
/Can't resolve '@swc\/wasm'/,
/Critical dependency: the request of a dependency is an expression/,
],
optimization: {
minimize: mode === "production",
splitChunks: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Generate full HTML with server-rendered content and hydration
* Generate full HTML (CSR)
*/
export function generateHTML(componentCode: string): string {
// we need to replace bare imports with esm CDN imports
Expand Down
2 changes: 1 addition & 1 deletion packages/xmcp/src/runtime/utils/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { openAIResourceRegistry } from "./openai-resource-registry";
import { flattenMeta } from "./openai/flatten-meta";
import fs from "fs";
import path from "path";
import { generateHTML } from "./react/bundler";
import { generateHTML } from "./react/generate-html";

declare const INJECTED_CLIENT_BUNDLES: Record<string, string> | undefined;

Expand Down