Skip to content

Commit 15af23b

Browse files
authored
fix: track Rstack config files in Rsbuild (#474)
1 parent b9060f7 commit 15af23b

3 files changed

Lines changed: 25 additions & 51 deletions

File tree

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import type {
2-
ConfigParams,
3-
RsbuildConfigDefinition,
4-
WatchFiles,
5-
} from '@rsbuild/core';
1+
import type { ConfigParams, RsbuildConfigDefinition } from '@rsbuild/core';
2+
import { withConfigMeta } from '@rstackjs/load-config';
63
import { loadRstackConfig, type Configs } from './config.ts';
74

85
const resolveRsbuildConfig = async (configs: Configs, params: ConfigParams) => {
@@ -20,30 +17,7 @@ const loadRsbuildConfig: RsbuildConfigDefinition = async (params) => {
2017
const { configs, filePath, dependencies } = await loadRstackConfig();
2118
const config = await resolveRsbuildConfig(configs, params);
2219

23-
if (!filePath) {
24-
return config;
25-
}
26-
27-
const watchFiles = config.dev?.watchFiles;
28-
const watchConfig: WatchFiles = {
29-
paths: [filePath, ...dependencies],
30-
type: 'reload-server',
31-
};
32-
33-
return {
34-
...config,
35-
dev: {
36-
...config.dev,
37-
watchFiles: [
38-
...(watchFiles
39-
? Array.isArray(watchFiles)
40-
? watchFiles
41-
: [watchFiles]
42-
: []),
43-
watchConfig,
44-
],
45-
},
46-
};
20+
return withConfigMeta(config, { filePath, dependencies });
4721
};
4822

4923
export default loadRsbuildConfig;

‎pnpm-lock.yaml‎

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cleanupUnusedCatalogs: true
1313

1414
catalog:
1515
'@napi-rs/cli': '^3.9.0'
16-
'@rsbuild/core': '~2.2.4'
16+
'@rsbuild/core': '~2.2.5'
1717
'@rsbuild/plugin-react': '^2.1.0'
1818
'@rsbuild/plugin-sass': '^2.0.1'
1919
'@rslib/core': '~1.0.0'
@@ -23,7 +23,7 @@ catalog:
2323
'@rspress/plugin-sitemap': '^2.0.21'
2424
'@rstackjs/doc-ui': '1.14.11'
2525
'@rstackjs/create-toolkit': '2.2.6'
26-
'@rstackjs/load-config': ^0.1.2
26+
'@rstackjs/load-config': ^1.0.0
2727
'@rstackjs/test-utils': ^1.0.0
2828
'@rstest/adapter-rsbuild': '~0.11.12'
2929
'@rstest/adapter-rslib': '~0.11.12'

0 commit comments

Comments
 (0)