Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Angular CLI-based template: Newer template does not support all packages that old one did when using SSR #1435

Closed
andrewjsaid opened this issue Dec 12, 2017 · 2 comments

Comments

@andrewjsaid
Copy link

Based on my comment in #1288

Scenario:
I created my project using the default VS2017 angular SPA template (used webpack). I used SSR and had a dependency on @ ng-bootstrap/ng-bootstrap. After upgrading to the new Angular Cli-based template, I can not use SSR.

The reason is that the library contains .js files (example: rating.js ) with import statements unsupported by node:

import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter, TemplateRef, ContentChild, forwardRef, ChangeDetectorRef } from '@angular/core';

Previously, I am guessing that the library would be bundled up by webpack and these statements would be rewritten. However since Angular Cli is not able to bundle the dependencies, the import statements remain and SSR fails because node can not execute these import statements.

Therefore, the new template does not support all the libraries that the old one did within the scope of server side rendering.

@SteveSandersonMS
Copy link
Member

The new template uses Angular CLI for compilation (both for the client and server builds), so the level of support for different compilation inputs depends entirely on what Angular CLI supports. Since Angular CLI itself uses Webpack internally to do the builds, it should be possible for them to support whatever Webpack supports, though it will depend on exactly how Angular CLI is implemented and configured. If there's functionality missing that you need, please consider reporting that to the Angular CLI project or possibly submitting a PR to them that implements what you need. Sorry this is now outside the scope of what we can control in this repo!

@lankaapura
Copy link

Hi @andrewjsaid,
Not sure you already figured this out, but this might help you fix this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants