@@ -14,17 +14,15 @@ import {
14
14
buildChecksum ,
15
15
ImportMap ,
16
16
parseExportNames ,
17
+ ReactResolve ,
17
18
SourceType ,
18
19
transform ,
19
20
TransformOptions
20
21
} from '../compiler/mod.ts'
21
22
import { EventEmitter } from '../framework/core/events.ts'
22
23
import { moduleExts , toPagePath , trimModuleExt } from '../framework/core/module.ts'
23
24
import { RouteModule , Routing } from '../framework/core/routing.ts'
24
- import {
25
- defaultReactEsmShBuildVersion , defaultReactVersion ,
26
- minDenoVersion
27
- } from '../shared/constants.ts'
25
+ import { minDenoVersion } from '../shared/constants.ts'
28
26
import {
29
27
ensureTextFile ,
30
28
existsDirSync ,
@@ -74,7 +72,7 @@ type TransformFn = (url: string, code: string) => string
74
72
export class Application implements ServerApplication {
75
73
readonly workingDir : string
76
74
readonly mode : 'development' | 'production'
77
- readonly config : Required < Config >
75
+ readonly config : Required < Config & { react : ReactResolve } >
78
76
readonly importMap : ImportMap
79
77
readonly ready : Promise < void >
80
78
@@ -145,10 +143,18 @@ export class Application implements ServerApplication {
145
143
146
144
const alephPkgUri = getAlephPkgUri ( )
147
145
const buildManifestFile = join ( this . buildDir , 'build.manifest.json' )
148
- const configChecksum = computeHash ( JSON . stringify ( {
149
- ...this . sharedCompileOptions ,
146
+ const plugins = computeHash ( JSON . stringify ( {
150
147
plugins : this . config . plugins . filter ( isLoaderPlugin ) . map ( ( { name } ) => name ) ,
151
- postcssPlugins : this . config . postcss . plugins . map ( p => p . toString ( ) )
148
+ postcssPlugins : this . config . postcss . plugins . map ( p => {
149
+ if ( util . isString ( p ) ) {
150
+ return p
151
+ } else if ( util . isArray ( p ) ) {
152
+ return p [ 0 ] + JSON . stringify ( p [ 1 ] )
153
+ } else {
154
+ p . toString ( )
155
+ }
156
+ } ) ,
157
+ react : this . config . react ,
152
158
} , ( key : string , value : any ) => {
153
159
if ( key === 'inlineStylePreprocess' ) {
154
160
return void 0
@@ -163,7 +169,7 @@ export class Application implements ServerApplication {
163
169
typeof v !== 'object' ||
164
170
v === null ||
165
171
v . compiler !== buildChecksum ||
166
- v . configChecksum !== configChecksum
172
+ v . plugins !== plugins
167
173
)
168
174
} catch ( e ) { }
169
175
}
@@ -182,7 +188,7 @@ export class Application implements ServerApplication {
182
188
aleph : VERSION ,
183
189
deno : Deno . version . deno ,
184
190
compiler : buildChecksum ,
185
- configChecksum ,
191
+ plugins ,
186
192
} , undefined , 2 ) )
187
193
}
188
194
@@ -696,8 +702,7 @@ export class Application implements ServerApplication {
696
702
return {
697
703
importMap : this . importMap ,
698
704
alephPkgUri : getAlephPkgUri ( ) ,
699
- reactVersion : defaultReactVersion ,
700
- fixedReactEsmShBuildVersion : defaultReactEsmShBuildVersion ,
705
+ react : this . config . react ,
701
706
isDev : this . isDev ,
702
707
inlineStylePreprocess : async ( key : string , type : string , tpl : string ) => {
703
708
if ( type !== 'css' ) {
0 commit comments