Skip to content

Commit 095407c

Browse files
authored
fix: track Rstack config files in Rslib (#475)
1 parent 15af23b commit 095407c

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

‎packages/rstack/src/rslibConfig.ts‎

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { WatchFiles } from '@rsbuild/core';
21
import type {
32
ConfigParams,
43
RslibConfig,
54
RslibConfigDefinition,
65
} from '@rslib/core';
6+
import { withConfigMeta } from '@rstackjs/load-config';
77
import { loadRstackConfig, type Configs } from './config.ts';
88

99
const resolveRslibConfig = async (
@@ -24,30 +24,7 @@ const loadRslibConfig = (async (params: ConfigParams) => {
2424
const { configs, filePath, dependencies } = await loadRstackConfig();
2525
const config = await resolveRslibConfig(configs, params);
2626

27-
if (!filePath) {
28-
return config;
29-
}
30-
31-
const watchFiles = config.dev?.watchFiles;
32-
const watchConfig: WatchFiles = {
33-
paths: [filePath, ...dependencies],
34-
type: 'restart',
35-
};
36-
37-
return {
38-
...config,
39-
dev: {
40-
...config.dev,
41-
watchFiles: [
42-
...(watchFiles
43-
? Array.isArray(watchFiles)
44-
? watchFiles
45-
: [watchFiles]
46-
: []),
47-
watchConfig,
48-
],
49-
},
50-
};
27+
return withConfigMeta(config, { filePath, dependencies });
5128
}) as RslibConfigDefinition;
5229

5330
export default loadRslibConfig;

0 commit comments

Comments
 (0)