File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
- import 'reflect-metadata' ;
2
- import 'zone.js' ;
3
-
4
1
import { enableProdMode } from '@angular/core' ;
5
2
import { renderModuleFactory } from '@angular/platform-server' ;
6
- import { join } from 'path' ;
7
- import { readFileSync } from 'fs-extra' ;
3
+ import { readFileSync , writeFileSync } from 'fs-extra' ;
8
4
import { log } from 'gulp-util' ;
5
+ import { join } from 'path' ;
6
+ import 'reflect-metadata' ;
7
+ import 'zone.js' ;
9
8
import { KitchenSinkServerModuleNgFactory } from './kitchen-sink/kitchen-sink.ngfactory' ;
10
9
11
10
enableProdMode ( ) ;
@@ -15,7 +14,10 @@ const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, {
15
14
} ) ;
16
15
17
16
result
18
- . then ( ( ) => log ( 'Prerender done.' ) )
17
+ . then ( content => {
18
+ writeFileSync ( join ( __dirname , 'index-prerendered.html' ) , content , 'utf-8' ) ;
19
+ log ( 'Prerender done.' ) ;
20
+ } )
19
21
// If rendering the module factory fails, exit the process with an error code because otherwise
20
22
// the CI task will not recognize the failure and will show as "success". The error message
21
23
// will be printed automatically by the `renderModuleFactory` method.
You can’t perform that action at this time.
0 commit comments