File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 11import fs from "fs/promises" ;
2+ import fsSync from "fs" ;
23import { dirname , join } from "path" ;
34import { createRequire } from "module" ;
45
@@ -43,18 +44,32 @@ async function compileAllAsc() {
4344 Object . assign ( config , m ) ;
4445 } catch ( e ) { }
4546 console . log ( `Compiling ${ ascFile } ...` ) ;
47+
48+ const wasmFile = ascFile . replace ( / \. t s $ / , ".wasm" ) ;
49+ if ( fsSync . existsSync ( wasmFile ) ) {
50+ await fs . unlink ( wasmFile ) ;
51+ }
52+
4653 const params = [
4754 "--runtime" ,
4855 "stub" ,
4956 "--exportRuntime" ,
5057 "--transform" ,
5158 transformFile ,
52- "--binaryFile " ,
59+ "--outFile " ,
5360 ascFile . replace ( / \. t s $ / , ".wasm" ) ,
5461 ascFile
5562 ] ;
5663 config . mangleCompilerParams ( params ) ;
57- await asc . main ( params ) ;
64+ const result = await asc . main ( params , {
65+ stderr : process . stderr ,
66+ stdout : process . stdout
67+ } ) ;
68+
69+ if ( result . error !== null ) {
70+ console . error ( `Failed to compile ${ ascFile } ` ) ;
71+ process . exit ( 1 ) ;
72+ }
5873 }
5974}
6075
You can’t perform that action at this time.
0 commit comments