File tree Expand file tree Collapse file tree 6 files changed +39
-25
lines changed Expand file tree Collapse file tree 6 files changed +39
-25
lines changed Original file line number Diff line number Diff line change @@ -109,26 +109,6 @@ export default defineConfig({
109109 return options ;
110110 } ,
111111 } ,
112- // Client / ESM
113- {
114- format : 'esm' ,
115- input : {
116- hmr : 'src/client/hmr.ts' ,
117- overlay : 'src/client/overlay.ts' ,
118- } ,
119- target : BUILD_TARGET . client ,
120- dts : false ,
121- externals : [ './hmr' ] ,
122- outDir : './dist/client' ,
123- autoExtension : true ,
124- externalHelpers : true ,
125- // Skip esbuild transform and only use SWC to transform,
126- // because esbuild will transform `import.meta`.
127- esbuildOptions : ( options ) => {
128- options . target = undefined ;
129- return options ;
130- } ,
131- } ,
132112 // Types
133113 {
134114 externals,
Original file line number Diff line number Diff line change 4646 " types.d.ts"
4747 ],
4848 "scripts" : {
49- "build" : " modern build && tsc-alias -p tsconfig.json" ,
49+ "build" : " modern build && rslib build && tsc-alias -p tsconfig.json" ,
50+ "build:rslib" : " rslib build" ,
5051 "dev" : " modern build --watch" ,
5152 "prebundle" : " prebundle"
5253 },
5859 },
5960 "devDependencies" : {
6061 "@modern-js/module-tools" : " ^2.61.0" ,
62+ "@rslib/core" : " 0.0.16" ,
6163 "@types/connect" : " 3.4.38" ,
6264 "@types/fs-extra" : " ^11.0.4" ,
6365 "@types/node" : " 18.x" ,
Original file line number Diff line number Diff line change 1+ import { defineConfig } from '@rslib/core' ;
2+
3+ export default defineConfig ( {
4+ lib : [
5+ // Client / ESM
6+ {
7+ format : 'esm' ,
8+ syntax : 'es2017' ,
9+ source : {
10+ entry : {
11+ hmr : 'src/client/hmr.ts' ,
12+ overlay : 'src/client/overlay.ts' ,
13+ } ,
14+ define : {
15+ WEBPACK_HASH : '__webpack_hash__' ,
16+ } ,
17+ } ,
18+ output : {
19+ target : 'web' ,
20+ externals : [ './hmr' ] ,
21+ distPath : {
22+ root : './dist/client' ,
23+ } ,
24+ } ,
25+ } ,
26+ ] ,
27+ } ) ;
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ function handleErrors(errors: Rspack.StatsError[]) {
120120
121121// __webpack_hash__ is the hash of the current compilation.
122122// It's a global variable injected by Rspack.
123- const isUpdateAvailable = ( ) => lastCompilationHash !== __webpack_hash__ ;
123+ const isUpdateAvailable = ( ) => lastCompilationHash !== WEBPACK_HASH ;
124124
125125// Attempt to update code on the fly, fall back to a hard reload.
126126function tryApplyUpdates ( ) {
Original file line number Diff line number Diff line change 11declare const RSBUILD_VERSION ;
22
3- declare let RSBUILD_CLIENT_CONFIG : ClientConfig ;
3+ declare const WEBPACK_HASH : string ;
44
5- declare let RSBUILD_DEV_LIVE_RELOAD : boolean ;
5+ declare const RSBUILD_CLIENT_CONFIG : ClientConfig ;
66
7- declare let RSBUILD_COMPILATION_NAME : string ;
7+ declare const RSBUILD_DEV_LIVE_RELOAD : boolean ;
8+
9+ declare const RSBUILD_COMPILATION_NAME : string ;
You can’t perform that action at this time.
0 commit comments