@@ -7,6 +7,7 @@ import { SharedInfo } from '@softarc/native-federation-runtime';
7
7
import { FederationOptions } from './federation-options' ;
8
8
import { copySrcMapIfExists } from '../utils/copy-src-map-if-exists' ;
9
9
import { logger } from '../utils/logger' ;
10
+ import { hashFile } from '../utils/hash-file' ;
10
11
11
12
export async function bundleShared (
12
13
config : NormalizedFederationConfig ,
@@ -24,14 +25,17 @@ export async function bundleShared(
24
25
'Make sure, you skip all unneeded packages in your federation.config.js'
25
26
) ;
26
27
28
+ const federationConfigPath = path . join ( fedOptions . workspaceRoot , fedOptions . federationConfig ) ;
29
+ const hash = hashFile ( federationConfigPath ) ;
30
+
27
31
for ( const pi of packageInfos ) {
28
32
// TODO: add logger
29
33
logger . info ( 'Bundling shared package ' + pi . packageName ) ;
30
34
31
35
const encName = pi . packageName . replace ( / [ ^ A - Z a - z 0 - 9 ] / g, '_' ) ;
32
36
const encVersion = pi . version . replace ( / [ ^ A - Z a - z 0 - 9 ] / g, '_' ) ;
33
37
34
- const outFileName = `${ encName } -${ encVersion } .js` ;
38
+ const outFileName = `${ encName } -${ encVersion } - ${ hash } .js` ;
35
39
36
40
const cachePath = path . join (
37
41
fedOptions . workspaceRoot ,
@@ -56,10 +60,14 @@ export async function bundleShared(
56
60
} ) ;
57
61
} catch ( e ) {
58
62
logger . error ( 'Error bundling ' + pi . packageName ) ;
63
+ if ( e instanceof Error ) {
64
+ logger . error ( e . message ) ;
65
+ }
66
+ logger . error ( 'For more information, run in verbose mode' ) ;
59
67
logger . notice (
60
68
`If you don't need this package, skip it in your federation.config.js!`
61
69
) ;
62
- logger . error ( e ) ;
70
+ logger . verbose ( e ) ;
63
71
continue ;
64
72
}
65
73
}
0 commit comments