File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ import * as packageJson from '../../../package.json'
2
+
1
3
const intEnv = ( envName : string , defaultValue : number ) : number => {
2
4
const value = parseInt ( process ?. env ?. [ envName ] || '' , 10 )
3
5
@@ -44,6 +46,8 @@ export const defaultConfig = {
44
46
) ,
45
47
} ,
46
48
app : {
49
+ version : packageJson . version ,
50
+ sha : process . env . GITHUB_SHA ,
47
51
env : process . env . NODE_ENV ,
48
52
type : process . env . RI_APP_TYPE ,
49
53
resourcesBaseUrl : process . env . RI_RESOURCES_BASE_URL ?? apiUrl , // todo: no usage found
Original file line number Diff line number Diff line change @@ -37,6 +37,18 @@ export default defineConfig({
37
37
svgr ( { include : [ '**/*.svg?react' ] } ) ,
38
38
reactClickToComponent ( ) ,
39
39
ViteEjsPlugin ( ) ,
40
+ // Inject app info to window global object via custom plugin
41
+ {
42
+ name : 'app-info' ,
43
+ transformIndexHtml ( html ) {
44
+ const script = `<script>window.appInfo = ${ JSON . stringify ( {
45
+ version : defaultConfig . app . version ,
46
+ sha : defaultConfig . app . sha ,
47
+ } ) } ;</script>`;
48
+
49
+ return html . replace ( / < h e a d > / , `<head>\n ${ script } ` ) ;
50
+ }
51
+ }
40
52
// !isElectron && compression({
41
53
// include: [/\.(js)$/, /\.(css)$/],
42
54
// deleteOriginalAssets: true
You can’t perform that action at this time.
0 commit comments