angular-cesium
angular-cesium copied to clipboard
Error when pre-rendering with angular universal
Intended outcome:
I tried to build angular-cesium with angular-universal but I receive the error below when I run
npm run build:prerender.
I made a fork of the angular-universal-starter project and included angular-cesium in it.
Actual outcome: Here are the Terminal logs
$ npm run build:prerender
> [email protected] build:prerender /Users/philip/Projects/universal-starter
> npm run build:client-and-server-bundles && npm run compile:server && npm run generate:prerender
> [email protected] build:client-and-server-bundles /Users/philip/Projects/universal-starter
> ng build --prod && ng run ng-universal-demo:server:production
Date: 2019-10-10T11:53:03.029Z
Hash: 4b944b29706a8b7e4a11
Time: 15366ms
chunk {0} runtime.a5b942d428324960b535.js (runtime) 2.17 kB [entry] [rendered]
chunk {1} main.fcd101c5e3e54e74a230.js (main) 580 kB [initial] [rendered]
chunk {2} polyfills.0d39ead6c08d58b8c106.js (polyfills) 66.4 kB [initial] [rendered]
chunk {3} styles.a8836591c01d727c4bd7.css (styles) 21.1 kB [initial] [rendered]
chunk {4} 4.621329a6bb065945abd8.js () 1.81 kB [rendered]
chunk {scripts} scripts.579f6945f12a91254f97.js (scripts) 2.84 MB [rendered]
Date: 2019-10-10T11:53:10.864Z
Hash: d8e0446a93d6ccf8d573
Time: 5046ms
chunk {main} main.js, main.js.map (main) 36.8 kB [entry] [rendered]
> [email protected] compile:server /Users/philip/Projects/universal-starter
> tsc -p server.tsconfig.json
> [email protected] generate:prerender /Users/philip/Projects/universal-starter
> cd dist && node prerender
/Users/philip/Projects/universal-starter/node_modules/angular2parse/src/parse.js:1
import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
^
SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:811:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
at Module.load (internal/modules/cjs/loader.js:731:32)
at Function.Module._load (internal/modules/cjs/loader.js:644:12)
at Module.require (internal/modules/cjs/loader.js:771:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.angular2parse/src/parse (/Users/philip/Projects/universal-starter/dist/server/main.js:576:18)
at __webpack_require__ (/Users/philip/Projects/universal-starter/dist/server/main.js:20:30)
at Object../src/app/app.server.module.ngfactory.js (/Users/philip/Projects/universal-starter/dist/server/main.js:233:11)
at __webpack_require__ (/Users/philip/Projects/universal-starter/dist/server/main.js:20:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] generate:prerender: `cd dist && node prerender`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] generate:prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/philip/.npm/_logs/2019-10-10T11_53_13_902Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:prerender: `npm run build:client-and-server-bundles && npm run compile:server && npm run generate:prerender`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:prerender script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/philip/.npm/_logs/2019-10-10T11_53_13_924Z-debug.log
How to reproduce the issue:
Clone this fork and run npm install and then npm run build:prerender
If you comment this line in app.module.ts and then build again it works.
// AngularCesiumModule.forRoot()
Version