Skip to content

Commit fa13a28

Browse files
committed
second fix ?
1 parent 7565631 commit fa13a28

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

web/oss/next.config.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,9 @@ const COMMON_CONFIG: NextConfig = {
8989
"rc-table",
9090
"@ant-design/icons",
9191
"@ant-design/icons-svg",
92-
"@ant-design/x",
9392
]
9493
: []),
9594
],
96-
// Configure ESM packages that need special handling
97-
serverExternalPackages: ["mermaid", "refractor"],
9895
...(!isDevelopment
9996
? {
10097
webpack: (config, {webpack, isServer}) => {
@@ -118,22 +115,18 @@ const COMMON_CONFIG: NextConfig = {
118115
loader: "swc-loader",
119116
})
120117

121-
// Mark ESM packages as external on server side to avoid bundling issues
122-
if (isServer) {
123-
config.externals = config.externals || []
124-
if (Array.isArray(config.externals)) {
125-
config.externals.push("mermaid")
126-
// Handle all refractor language imports as external
127-
config.externals.push(
128-
({request}: {request?: string}, callback: (err?: Error | null, result?: string) => void) => {
129-
if (request && request.startsWith("refractor/")) {
130-
return callback(null, `commonjs ${request}`)
131-
}
132-
callback()
133-
},
134-
)
135-
}
136-
}
118+
// Ignore problematic ESM imports from @ant-design/x that we don't use
119+
// This prevents build errors for mermaid and refractor packages
120+
config.plugins.push(
121+
new webpack.IgnorePlugin({
122+
resourceRegExp: /^mermaid$/,
123+
contextRegExp: /@ant-design[\\/]x/,
124+
}),
125+
new webpack.IgnorePlugin({
126+
resourceRegExp: /^refractor\/.+$/,
127+
contextRegExp: /react-syntax-highlighter/,
128+
}),
129+
)
137130

138131
if (!isServer) {
139132
config.plugins.push(

0 commit comments

Comments
 (0)