Skip to content

Commit 02e6cc4

Browse files
authored
core: Optimize Client Development Experience (#1010)
1 parent 2a6111b commit 02e6cc4

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

packages/client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"license": "MIT",
1414
"scripts": {
1515
"dev": "rsbuild dev",
16-
"start": "rsbuild build -w",
16+
"start": "NODE_ENV=development rsbuild build -w",
1717
"build": "rsbuild build",
1818
"build:analysis": "ENABLE_DEVTOOLS_PLUGIN=true DEVTOOLS_DEV=true rsbuild build",
1919
"preview": "rsbuild preview"
@@ -36,6 +36,7 @@
3636
"react-error-boundary": "^4.1.2",
3737
"react-router-dom": "6.4.3",
3838
"sirv": "2.0.4",
39+
"source-map-loader": "^5.0.0",
3940
"typescript": "^5.2.2"
4041
},
4142
"publishConfig": {

packages/client/rsbuild.config.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import type { RsbuildConfig, Rspack } from '@rsbuild/core';
12
import { defineConfig } from '@rsbuild/core';
2-
import { pluginReact } from '@rsbuild/plugin-react';
3-
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
43
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
5-
import type { Rspack, RsbuildConfig } from '@rsbuild/core';
4+
import { pluginReact } from '@rsbuild/plugin-react';
65
import { pluginSass } from '@rsbuild/plugin-sass';
7-
import serve from 'sirv';
8-
import path from 'path';
6+
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
97
import fs from 'fs';
8+
import path from 'path';
9+
import serve from 'sirv';
1010

1111
import {
1212
ClientEntry,
@@ -179,6 +179,17 @@ export default defineConfig(({ env }) => {
179179
]);
180180
}
181181
},
182+
rspack: {
183+
module: {
184+
rules: [
185+
!IS_PRODUCTION && {
186+
test: /\.js$/,
187+
enforce: 'pre' as const,
188+
use: ['source-map-loader'],
189+
},
190+
].filter(Boolean),
191+
},
192+
},
182193
},
183194

184195
html: {

packages/components/modern.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { moduleTools, defineConfig } from '@modern-js/module-tools';
1+
import { defineConfig, moduleTools } from '@modern-js/module-tools';
22

33
export default defineConfig({
44
plugins: [moduleTools()],
@@ -7,6 +7,8 @@ export default defineConfig({
77
format: 'esm',
88
target: 'es2020',
99
outDir: './dist',
10+
sourceMap: true,
11+
minify: false,
1012
asset: {
1113
svgr: {
1214
include: /\.svg$/,

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)