@@ -103,6 +103,19 @@ class HTML5Platform extends PlatformTarget
103103
104104 public override function build (): Void
105105 {
106+ if (npm )
107+ {
108+ if (command == " build" )
109+ {
110+ var buildCommand = " build:" + (project .targetFlags .exists (" final" ) ? " prod" : " dev" );
111+ System .runCommand (targetDirectory + " /bin" , " npm" , [" run" , buildCommand , " -s" ]);
112+ }
113+ else
114+ {
115+ return ;
116+ }
117+ }
118+
106119 ModuleHelper .buildModules (project , targetDirectory + " /obj" , targetDirectory + " /bin" );
107120
108121 if (project .app .main != null )
@@ -162,19 +175,6 @@ class HTML5Platform extends PlatformTarget
162175 HTML5Helper .minify (project , targetDirectory + " /bin/" + project .app .file + " .js" );
163176 }
164177 }
165-
166- if (npm )
167- {
168- if (command == " build" )
169- {
170- var buildCommand = " build:" + (project .targetFlags .exists (" final" ) ? " prod" : " dev" );
171- System .runCommand (targetDirectory + " /bin" , " npm" , [" run" , buildCommand , " -s" ]);
172- }
173- else
174- {
175- return ;
176- }
177- }
178178 }
179179
180180 public override function clean (): Void
@@ -254,10 +254,10 @@ class HTML5Platform extends PlatformTarget
254254
255255 try
256256 {
257- if (project . defines . exists ( " npm " ) || targetFlags .exists (" npm" ) || (FileSystem .exists (targetDirectory + " /bin/package.json" ) && ! targetFlags .exists (" electron" )))
257+ if (targetFlags .exists (" npm" ) || (FileSystem .exists (targetDirectory + " /bin/package.json" ) && ! targetFlags .exists (" electron" )))
258258 {
259259 npm = true ;
260- // outputFile = project.app.file + ".js";
260+ outputFile = project .app .file + " .js" ;
261261 }
262262 }
263263 catch (e : Dynamic ) {}
@@ -288,6 +288,7 @@ class HTML5Platform extends PlatformTarget
288288 // project = project.clone ();
289289
290290 var destination = targetDirectory + " /bin/" ;
291+ if (npm ) destination + = " dist/" ;
291292 System .mkdir (destination );
292293
293294 var webfontDirectory = targetDirectory + " /obj/webfont" ;
0 commit comments