Commit 57c6341 1 parent 56fe16e commit 57c6341 Copy full SHA for 57c6341
File tree 6 files changed +39
-25
lines changed
6 files changed +39
-25
lines changed Original file line number Diff line number Diff line change @@ -109,26 +109,6 @@ export default defineConfig({
109
109
return options ;
110
110
} ,
111
111
} ,
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
- } ,
132
112
// Types
133
113
{
134
114
externals,
Original file line number Diff line number Diff line change 46
46
" types.d.ts"
47
47
],
48
48
"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" ,
50
51
"dev" : " modern build --watch" ,
51
52
"prebundle" : " prebundle"
52
53
},
58
59
},
59
60
"devDependencies" : {
60
61
"@modern-js/module-tools" : " ^2.61.0" ,
62
+ "@rslib/core" : " 0.0.16" ,
61
63
"@types/connect" : " 3.4.38" ,
62
64
"@types/fs-extra" : " ^11.0.4" ,
63
65
"@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[]) {
120
120
121
121
// __webpack_hash__ is the hash of the current compilation.
122
122
// It's a global variable injected by Rspack.
123
- const isUpdateAvailable = ( ) => lastCompilationHash !== __webpack_hash__ ;
123
+ const isUpdateAvailable = ( ) => lastCompilationHash !== WEBPACK_HASH ;
124
124
125
125
// Attempt to update code on the fly, fall back to a hard reload.
126
126
function tryApplyUpdates ( ) {
Original file line number Diff line number Diff line change 1
1
declare const RSBUILD_VERSION ;
2
2
3
- declare let RSBUILD_CLIENT_CONFIG : ClientConfig ;
3
+ declare const WEBPACK_HASH : string ;
4
4
5
- declare let RSBUILD_DEV_LIVE_RELOAD : boolean ;
5
+ declare const RSBUILD_CLIENT_CONFIG : ClientConfig ;
6
6
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