@@ -878,6 +878,12 @@ const traverseEntryQuery = (
878
878
export const appendEntryQuery = ( entries : RsbuildConfigEntry ) : RsbuildEntry =>
879
879
traverseEntryQuery ( entries , ( item ) => `${ item } ?${ RSLIB_ENTRY_QUERY } ` ) ;
880
880
881
+ export const resolveEntryPath = (
882
+ entries : RsbuildConfigEntry ,
883
+ root : string ,
884
+ ) : RsbuildEntry =>
885
+ traverseEntryQuery ( entries , ( item ) => path . resolve ( root , item ) ) ;
886
+
881
887
const composeEntryConfig = async (
882
888
rawEntry : RsbuildConfigEntry ,
883
889
bundle : LibConfig [ 'bundle' ] ,
@@ -939,7 +945,7 @@ const composeEntryConfig = async (
939
945
return {
940
946
entryConfig : {
941
947
source : {
942
- entry : appendEntryQuery ( entries ) ,
948
+ entry : appendEntryQuery ( resolveEntryPath ( entries , root ) ) ,
943
949
} ,
944
950
} ,
945
951
lcp : null ,
@@ -1044,6 +1050,7 @@ const composeBundlelessExternalConfig = (
1044
1050
redirect : Redirect ,
1045
1051
cssModulesAuto : CssLoaderOptionsAuto ,
1046
1052
bundle : boolean ,
1053
+ rootPath : string ,
1047
1054
) : {
1048
1055
config : EnvironmentConfig ;
1049
1056
resolvedJsRedirect ?: DeepRequired < JsRedirect > ;
@@ -1083,9 +1090,12 @@ const composeBundlelessExternalConfig = (
1083
1090
let resolvedRequest = request ;
1084
1091
// use resolver to resolve the request
1085
1092
resolvedRequest = await resolver ! ( context ! , resolvedRequest ) ;
1093
+ const isSubpath = resolvedRequest . startsWith (
1094
+ rootPath + path . sep ,
1095
+ ) ;
1086
1096
1087
- // only handle the request that is not in node_modules
1088
- if ( ! resolvedRequest . includes ( 'node_modules' ) ) {
1097
+ // only handle the request that within the root path
1098
+ if ( isSubpath ) {
1089
1099
resolvedRequest = normalizeSlash (
1090
1100
path . relative ( path . dirname ( issuer ) , resolvedRequest ) ,
1091
1101
) ;
@@ -1359,6 +1369,7 @@ async function composeLibRsbuildConfig(
1359
1369
redirect ,
1360
1370
cssModulesAuto ,
1361
1371
bundle ,
1372
+ rootPath ,
1362
1373
) ;
1363
1374
const {
1364
1375
config : targetConfig ,
0 commit comments