File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 29
29
"[jsonc]" : {
30
30
"editor.defaultFormatter" : " biomejs.biome"
31
31
},
32
+ "[json]" : {
33
+ "editor.defaultFormatter" : " biomejs.biome"
34
+ },
35
+ "[typescript]" : {
36
+ "editor.defaultFormatter" : " biomejs.biome"
37
+ },
32
38
"[plaintext]" : {
33
39
"editor.defaultFormatter" : " esbenp.prettier-vscode"
34
40
},
Original file line number Diff line number Diff line change
1
+ import path from 'node:path' ;
1
2
import { defineConfig , moduleTools } from '@modern-js/module-tools' ;
2
3
import { version } from './package.json' ;
3
4
@@ -15,6 +16,9 @@ export default defineConfig({
15
16
target : 'es2020' ,
16
17
define : {
17
18
__VERSION__ : version ,
19
+ __DEV_REPORT_PATH__ : process . env . USE_DEV_REPORT
20
+ ? path . resolve ( __dirname , '../../apps/report/dist/index.html' )
21
+ : '' ,
18
22
} ,
19
23
splitting : true ,
20
24
sourceMap : true ,
Original file line number Diff line number Diff line change 25
25
"scripts" : {
26
26
"dev" : " npm run build:watch" ,
27
27
"build" : " modern build" ,
28
- "build:watch" : " modern build -w --no-clear" ,
28
+ "build:watch" : " USE_DEV_REPORT=1 modern build -w --no-clear" ,
29
29
"new" : " modern new" ,
30
30
"upgrade" : " modern upgrade" ,
31
31
"test" : " vitest --run" ,
Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ export const groupedActionDumpFileExt = 'web-dump.json';
25
25
26
26
const reportInitializedMap = new Map < string , boolean > ( ) ;
27
27
28
+ declare const __DEV_REPORT_PATH__ : string ;
29
+
28
30
function getReportTpl ( ) {
31
+ if ( __DEV_REPORT_PATH__ ) {
32
+ return fs . readFileSync ( __DEV_REPORT_PATH__ , 'utf-8' ) ;
33
+ }
29
34
const reportTpl = 'REPLACE_ME_WITH_REPORT_HTML' ;
30
35
31
36
return reportTpl ;
@@ -52,7 +57,7 @@ export function insertScriptBeforeClosingHtml(
52
57
const tailStr = buffer . toString ( 'utf8' ) ;
53
58
const htmlEndIdx = tailStr . lastIndexOf ( htmlEndTag ) ;
54
59
if ( htmlEndIdx === - 1 ) {
55
- throw new Error ( ' No </html> found' ) ;
60
+ throw new Error ( ` No </html> found in file: ${ filePath } ` ) ;
56
61
}
57
62
58
63
// calculate the correct byte position: char position to byte position
You can’t perform that action at this time.
0 commit comments