Skip to content

Commit

Permalink
fix: support compileDependencies in speedup mode (#6925)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Aug 15, 2024
1 parent 39b7dac commit 47a5773
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/popular-buttons-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ice/rspack-config': patch
---

fix: support compileDendencies in speedup mode
11 changes: 10 additions & 1 deletion packages/rspack-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,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('|')}).*`;
}
Expand Down

0 comments on commit 47a5773

Please sign in to comment.