mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
build: move server rendering to dist (#4822)
* build: move server rendering to dist * Verifying that Material works with `platform-server` now happens in the `dist/` folder (instead of the src/ folder) * Adds a gulp task to build the universal application. In the future serving the app will be also part of this * Address comments
This commit is contained in:
committed by
mmalerba
parent
12d6e968c2
commit
fb5520cebf
@@ -0,0 +1 @@
|
||||
export * from './kitchen-sink/kitchen-sink';
|
||||
@@ -1,15 +1,16 @@
|
||||
import 'reflect-metadata';
|
||||
require('zone.js/dist/zone-node.js');
|
||||
import 'zone.js';
|
||||
|
||||
import {enableProdMode} from '@angular/core';
|
||||
import {renderModuleFactory} from '@angular/platform-server';
|
||||
import {KitchenSinkServerModuleNgFactory} from './dist/aot/kitchen-sink/kitchen-sink.ngfactory';
|
||||
import {join} from 'path';
|
||||
import {readFileSync} from 'fs-extra';
|
||||
import {KitchenSinkServerModuleNgFactory} from './kitchen-sink/kitchen-sink.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
|
||||
const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, {
|
||||
document: readFileSync('src/universal-app/index.html', 'utf-8')
|
||||
document: readFileSync(join(__dirname, 'index.html'), 'utf-8')
|
||||
});
|
||||
|
||||
result.then(html => console.log(html));
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// TypeScript config file that is used to compile the universal-app.
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"stripInternal": false,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/packages/universal-app",
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"target": "es2015",
|
||||
"lib": ["es2015", "dom"],
|
||||
"skipLibCheck": true,
|
||||
"types": [],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@angular/material": ["./material"],
|
||||
"@angular/cdk": ["./cdk"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"genDir": "../../dist/packages/universal-app"
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"target": "es6",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"outDir": "dist",
|
||||
"declaration": true,
|
||||
"typeRoots": ["node_modules/@types"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
"prerender.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"annotationsAs": "static fields",
|
||||
"annotateForClosureCompiler": true,
|
||||
"genDir": "./dist/aot"
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,25 @@
|
||||
// TypeScript config file that is used to compile the files that prerender the Universal app.
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2015", "dom"],
|
||||
"target": "es6",
|
||||
"declaration": false,
|
||||
"stripInternal": false,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist",
|
||||
"noEmitOnError": true,
|
||||
"noImplicitAny": true,
|
||||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"types": ["node"]
|
||||
"outDir": ".",
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"target": "es2015",
|
||||
"lib": ["es2015", "dom"],
|
||||
"skipLibCheck": true,
|
||||
"types": [],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@angular/material": ["./material"],
|
||||
"@angular/cdk": ["./cdk"]
|
||||
}
|
||||
},
|
||||
"files": ["prerender.ts"]
|
||||
"files": [
|
||||
"prerender.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user