docs: add universal guide with production client app (#18707)

Revises both universal and client build to use AOT and webpack for both.
Guide text adjusted accordingly
Dodges CLI client build, expected in near future.

PR Close #18707
This commit is contained in:
Ward Bell
2017-09-14 19:47:33 -07:00
committed by Chuck Jazdzewski
parent 0b0d25fa33
commit 555b1cdf29
14 changed files with 1419 additions and 1177 deletions

View File

@ -1,40 +1,44 @@
// #docregion
const ngtools = require('@ngtools/webpack');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
devtool: 'source-map',
// #docregion entry
entry: {
main: [
'./src/universal/app-server.module.ts',
'./src/universal/server.ts'
]
},
// #enddocregion entry
resolve: {
extensions: ['.ts', '.js']
},
target: 'node',
// #docregion output
output: {
path: 'src/dist',
path: 'dist',
filename: 'server.js'
},
// #enddocregion output
// #docregion plugins
plugins: [
// compile with AOT
new ngtools.AotPlugin({
tsConfigPath: './tsconfig-universal.json'
})
tsConfigPath: './tsconfig.universal.json'
}),
// copy assets to the output (/dist) folder
new CopyWebpackPlugin([
{from: 'src/index-universal.html'},
{from: 'src/favicon.ico'},
{from: 'src/styles.css'},
{from: 'node_modules/core-js/client/shim.min.js'},
{from: 'node_modules/zone.js/dist/zone.min.js'},
])
],
// #enddocregion plugins
// #docregion rules
module: {
rules: [
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.ts$/, loader: '@ngtools/webpack' }
{ test: /\.ts$/, loader: '@ngtools/webpack' }
]
}
// #enddocregion rules
}