|
36 | 36 | - [On-demand rendering using express](#on-demand-rendering-using-express)
|
37 | 37 | - [On-demand rendering using koa](#on-demand-rendering-using-koa)
|
38 | 38 | - [FAQ](#faq)
|
| 39 | +- [Troubleshooting](#troubleshooting) |
39 | 40 | - [Comments, queries, or rants](#comments-queries-or-rants)
|
40 | 41 |
|
41 | 42 | # Introduction
|
@@ -619,6 +620,34 @@ A project using koa and `angular-ssr` lives in the [`examples/demand-koa`](https
|
619 | 620 | * The `angular-ssr` package will be split into `@angular-ssr/server`, `@angular-ssr/client` and a couple other packages. This will allow us to build some cool client-side features that will integrate with the server-side rendering functionality.
|
620 | 621 | * As `@angular/platform-server` fills out and matures, `angular-ssr` will eventually become obsolete. The Angular team is working on a lot of great features (with some inspiration from `angular-ssr` -- for instance, a real DOM implementation!). These changes will ultimately make `angular-ssr` redundant. But the cost of transitioning from `angular-ssr` to `platform-server` will be minimal because the API surface of both libraries are tiny. So I would recommend using `angular-ssr` today and upgrading to `platform-server` in the next 6 months or a year or so.
|
621 | 622 |
|
| 623 | +# Troubleshooting |
| 624 | + |
| 625 | +If you are using `ng-render` and your build fails with this error: |
| 626 | + |
| 627 | +``` |
| 628 | +ERROR in ./src/app/app.module.ts |
| 629 | +Module build failed: TypeError: Cannot read property 'newLine' of undefined |
| 630 | + at Object.getNewLineCharacter (/home/bond/project/node_modules/typescript/lib/typescript.js:9514:20) |
| 631 | + at Object.createCompilerHost (/home/bond/project/node_modules/typescript/lib/typescript.js:63770:26) |
| 632 | + at Object.ngcLoader (/home/bond/project/node_modules/@ngtools/webpack/src/loader.js:380:33) |
| 633 | + @ multi ./app/app.module.ts |
| 634 | + ``` |
| 635 | + |
| 636 | +This is because you are attempting to use the AoT loader, `@ngtools/webpack`, with `ng-render`. Please do not do this. You should only be using `@ngtools/webpack` for production AoT builds, not `ng-render` builds. Therefore in your `webpack.config.js`, only enable the AoT loader in production mode: |
| 637 | + |
| 638 | +``` |
| 639 | +const production = !process.env.NG_RENDER && process.env.NODE_ENV === 'production'; |
| 640 | +``` |
| 641 | + |
| 642 | +Then in the loader chain description for TypeScript files: |
| 643 | + |
| 644 | +``` |
| 645 | +{ |
| 646 | + test: /\.ts$/, |
| 647 | + use: production ? ['@ngtools/webpack'] : ['ts-helper', 'angular2-template-loader', 'angular-router-loader'] |
| 648 | +} |
| 649 | +``` |
| 650 | + |
622 | 651 | # Comments, queries, or rants
|
623 | 652 |
|
624 | 653 | Direct your vitriol to cb@clbond.org or post an issue on this GitHub repo!
|
|
0 commit comments