@@ -174,24 +174,28 @@ export async function loadAndUpgradeImportMap(workingDir: string): Promise<Impor
174
174
await Deno . writeTextFile ( importMapFile , JSON . stringify ( importMap , undefined , 2 ) )
175
175
}
176
176
177
- return importMap
178
- }
179
-
180
- export function defaultImportMap ( reactVersion : string ) : ImportMap {
177
+ const v = Deno . env . get ( 'ALEPH_DEV' )
181
178
const alephPkgUri = getAlephPkgUri ( )
182
- return {
183
- imports : {
184
- 'aleph/' : `${ alephPkgUri } /` ,
185
- 'framework' : `${ alephPkgUri } /framework/core/mod.ts` ,
186
- 'framework/react' : `${ alephPkgUri } /framework/react/mod.ts` ,
187
- 'react' : `https://esm.sh/react@${ reactVersion } ` ,
188
- 'react-dom' : `https://esm.sh/react-dom@${ reactVersion } ` ,
189
- 'react-dom/server' : `https://esm.sh/react-dom@${ reactVersion } /server` ,
190
- } ,
191
- scopes : { }
179
+ const defaultImports : Record < string , string > = {
180
+ 'aleph/' : `${ alephPkgUri } /` ,
181
+ 'framework' : `${ alephPkgUri } /framework/core/mod.ts` ,
182
+ 'framework/react' : `${ alephPkgUri } /framework/react/mod.ts` ,
183
+ 'react' : `https://esm.sh/react@${ defaultReactVersion } ` ,
184
+ 'react-dom' : `https://esm.sh/react-dom@${ defaultReactVersion } ` ,
185
+ 'react-dom/server' : `https://esm.sh/react-dom@${ defaultReactVersion } /server` ,
186
+ }
187
+ // in aleph dev mode, use default imports instead of app settings
188
+ if ( v !== undefined ) {
189
+ Object . assign ( importMap . imports , defaultImports )
190
+ } else {
191
+ importMap . imports = Object . assign ( defaultImports , importMap . imports , )
192
192
}
193
+
194
+ return importMap
193
195
}
194
196
197
+
198
+
195
199
function isFramework ( v : any ) : v is 'react' {
196
200
switch ( v ) {
197
201
case 'react' :
0 commit comments