diff --git a/.changeset/popular-buttons-behave.md b/.changeset/popular-buttons-behave.md new file mode 100644 index 0000000000..16320714b8 --- /dev/null +++ b/.changeset/popular-buttons-behave.md @@ -0,0 +1,5 @@ +--- +'@ice/rspack-config': patch +--- + +fix: support compileDendencies in speedup mode diff --git a/packages/rspack-config/src/index.ts b/packages/rspack-config/src/index.ts index 205a3441dd..b614513dde 100644 --- a/packages/rspack-config/src/index.ts +++ b/packages/rspack-config/src/index.ts @@ -169,7 +169,16 @@ const getConfig: GetConfig = async (options) => { if (!compileIncludes || compileIncludes?.length === 0) { excludeRule = 'node_modules'; } else if (!compileIncludes?.includes('node_modules') && compileIncludes?.length > 0) { - excludeRule = `node_modules[\\/](?!${compileIncludes.map((pkg: string) => { + const flattenIncludes = []; + compileIncludes.forEach((pkg) => { + if (typeof pkg === 'string') { + flattenIncludes.push(pkg); + } else { + // The RegExp type of pkg may include multiple source paths. + flattenIncludes.push(...pkg.source.split('|')); + } + }); + excludeRule = `node_modules[\\/](?!${flattenIncludes.map((pkg: string) => { return `${pkg}[\\/]|_${pkg.replace('/', '_')}@[^/]+[\\/]`; }).join('|')}).*`; }