diff --git a/packages/bundler-webpack/src/config/cssRules.ts b/packages/bundler-webpack/src/config/cssRules.ts index aa84f6460e0e..193e5aabcb93 100644 --- a/packages/bundler-webpack/src/config/cssRules.ts +++ b/packages/bundler-webpack/src/config/cssRules.ts @@ -84,10 +84,13 @@ export async function addCSSRules(opts: IOpts) { }); } - // If SSR is enabled, we need to handling the css modules name hashing + // If SSR with bundler esbuild is enabled, we need to handling the css modules name hashing // and save the class names mapping into opts.cssModulesMapping // so the esbuild can use it to generate the correct name for the server side - const getLocalIdent = userConfig.ssr && getLocalIdentForSSR; + const getLocalIdent = + userConfig.ssr && userConfig.ssr.compiler === 'esbuild' + ? getLocalIdentForSSR + : undefined; const localIdentName = '[local]___[hash:base64:5]'; let cssLoaderModulesConfig: any;