Skip to content

Commit af01bf0

Browse files
fix: configure rsbuild-plugin to build like other rollup packages
- Update tsconfig.json to use TypeScript project references structure - Create missing tsconfig.lib.json and tsconfig.spec.json files - Update project.json to use tsconfig.lib.json and add external dependencies - Fix missing return statement in isStoryBook function - Fix NODE_ENV access to use bracket notation for strict mode - Brings rsbuild-plugin build configuration in line with other rollup packages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1f3950a commit af01bf0

File tree

6 files changed

+49
-22
lines changed

6 files changed

+49
-22
lines changed

packages/rsbuild-plugin/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"options": {
1111
"outputPath": "packages/rsbuild-plugin/dist",
1212
"main": "packages/rsbuild-plugin/cli/src/index.ts",
13-
"tsConfig": "packages/rsbuild-plugin/tsconfig.json",
13+
"tsConfig": "packages/rsbuild-plugin/tsconfig.lib.json",
1414
"assets": [],
15+
"external": ["@module-federation/*"],
1516
"project": "packages/rsbuild-plugin/package.json",
1617
"rollupConfig": "packages/rsbuild-plugin/rollup.config.js",
1718
"compiler": "swc",

packages/rsbuild-plugin/src/cli/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function isStoryBook(rsbuildConfig: RsbuildConfig) {
7272
) {
7373
return true;
7474
}
75+
return false;
7576
}
7677

7778
export function isMFFormat(bundlerConfig: Rspack.Configuration) {

packages/rsbuild-plugin/src/utils/ssr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function setSSREnv() {
1818
}
1919

2020
const isDev = () => {
21-
return process.env.NODE_ENV === 'development';
21+
return process.env['NODE_ENV'] === 'development';
2222
};
2323

2424
export function patchSSRRspackConfig(

packages/rsbuild-plugin/tsconfig.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
{
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
4-
"baseUrl": ".",
5-
"rootDir": "./",
6-
"outDir": "dist",
7-
"sourceMap": false,
8-
"module": "es2022",
9-
"target": "es2022",
10-
"skipLibCheck": true,
11-
"moduleResolution": "node",
12-
"allowJs": false,
4+
"module": "commonjs",
5+
"forceConsistentCasingInFileNames": true,
136
"strict": true,
14-
"types": ["jest", "node"],
15-
"experimentalDecorators": true,
7+
"noImplicitOverride": true,
8+
"noPropertyAccessFromIndexSignature": true,
9+
"noImplicitReturns": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"moduleResolution": "node",
1612
"resolveJsonModule": true,
17-
"allowSyntheticDefaultImports": true,
1813
"esModuleInterop": true,
19-
"removeComments": true,
20-
"declaration": true,
21-
"paths": {
22-
"@/*": ["./*"],
23-
"@src/*": ["./src/*"]
24-
}
14+
"skipLibCheck": true,
15+
"skipDefaultLibCheck": true,
16+
"declaration": true
2517
},
26-
"include": ["src", "../../global.d.ts", "__tests__/**/*"],
27-
"exclude": ["node_modules/**/*", "../node_modules"]
18+
"files": [],
19+
"include": [],
20+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
21+
"references": [
22+
{
23+
"path": "./tsconfig.lib.json"
24+
},
25+
{
26+
"path": "./tsconfig.spec.json"
27+
}
28+
]
2829
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"declaration": true,
6+
"types": ["node"]
7+
},
8+
"include": ["src/**/*.ts"],
9+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["jest", "node"]
7+
},
8+
"include": [
9+
"jest.config.ts",
10+
"src/**/*.test.ts",
11+
"src/**/*.spec.ts",
12+
"src/**/*.d.ts"
13+
]
14+
}

0 commit comments

Comments
 (0)