@@ -12,10 +12,12 @@ import {
1212import { resolve } from 'path'
1313import { NgProdPlugin } from '../fusebox/ng.prod.plugin'
1414import { NgPolyfillPlugin } from '../fusebox/ng.polyfill.plugin'
15- import { NgCompilerPlugin } from '../fusebox/ng.compiler.plugin'
1615import readConfig_ from '../utilities/read-config'
1716import { Ng2TemplatePlugin } from 'ng2-fused'
1817import { FuseProcess } from 'fuse-box/FuseProcess'
18+ import { NgAotFactoryPlugin } from '../fusebox/ng.aot-factory.plugin'
19+ import clearTerminal from '../utilities/clear'
20+ import { main as ngc } from '@angular/compiler-cli/src/main'
1921
2022command (
2123 'serve [port][prod][aot][sw]' ,
@@ -63,6 +65,8 @@ function serve(isProdBuild = false) {
6365 ? config . fusebox . browser . aotBrowserModule
6466 : config . fusebox . browser . browserModule
6567
68+ isAotBuild && ngc ( [ '-p' , resolve ( 'tsconfig.aot.json' ) ] )
69+
6670 const fuseBrowser = FuseBox . init ( {
6771 log,
6872 modulesFolder,
@@ -72,12 +76,11 @@ function serve(isProdBuild = false) {
7276 target : 'browser@es5' ,
7377 useTypescriptCompiler : true ,
7478 plugins : [
79+ isAotBuild && NgAotFactoryPlugin ( ) ,
7580 Ng2TemplatePlugin ( ) ,
7681 [ '*.component.html' , RawPlugin ( ) ] ,
7782 NgProdPlugin ( { enabled : isProdBuild } ) ,
78- NgCompilerPlugin ( { enabled : isAotBuild } ) ,
7983 NgPolyfillPlugin ( ) ,
80- // NgOptimizerPlugin({ enabled: opts.enableAngularBuildOptimizer }),
8184 [
8285 '*.component.css' ,
8386 SassPlugin ( {
@@ -146,6 +149,7 @@ function serve(isProdBuild = false) {
146149 . instructions ( ` > [${ config . fusebox . server . serverModule } ]` )
147150 . completed ( proc => {
148151 prevServerProcess && prevServerProcess . kill ( )
152+ clearTerminal ( )
149153 proc . start ( )
150154 prevServerProcess = proc
151155 } )
@@ -156,6 +160,7 @@ function serve(isProdBuild = false) {
156160 . bundle ( 'app' )
157161 . watch ( watchDir )
158162 . instructions ( ` !> [${ browserModule } ]` )
163+ . splitConfig ( { dest : '../js/modules' } )
159164
160165 logInfo ( 'Bundling your application, this may take some time...' )
161166 fuseBrowser . run ( )
0 commit comments