Skip to content

AppServerModuleNgFactory not exported for VE with version 9 approach #15851

Closed

Description

@alan-agius4

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [x] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes

Description

Currently in ngtools we rely on isMainPath, getEntryModule to run the export_ngfactory transformer, however in version 9 the main will be pointing to server.ts rather than main.server.ts.

This causes the transformer to run on the wrong file in VE.

🔬 Minimal Reproduction

  • npx i @angular/[email protected] new universal-test
  • cd universal-test
  • ng add @nguniversal/[email protected]
  • disable ivy
  • in server.ts change AppServerModule to AppServerModuleNgFactory to use AOT as otherwise you will use the JIT version of the code.
  • npm run build:ssr

🔥 Exception or Error


ERROR in server.ts:7:10 - error TS2305: Module '"C:/git/cli-repos/terser/src/main.server"' has no exported member 'AppServerModuleNgFactory'.

7 import { AppServerModuleNgFactory } from './src/main.server';
           ~~~~~~~~~~~~~~~~~~~~~~~~

🌍 Your Environment


Angular CLI: 9.0.0-next.9
Node: 12.10.0
OS: win32 x64
Angular: 9.0.0-next.10
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-next.9
@angular-devkit/build-angular     0.900.0-next.9
@angular-devkit/build-optimizer   0.900.0-next.9
@angular-devkit/build-webpack     0.900.0-next.9
@angular-devkit/core              9.0.0-next.9
@angular-devkit/schematics        9.0.0-next.9
@angular/cli                      9.0.0-next.9
@angular/platform-server          9.0.0-next.11
@ngtools/webpack                  9.0.0-next.9
@nguniversal/common               9.0.0-next.5
@nguniversal/express-engine       9.0.0-next.5
@schematics/angular               9.0.0-next.9
@schematics/update                0.900.0-next.9
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.41.0

Anything else relevant?
As a workaround users need to manually add the below export in main.server.ts

export { AppServerModuleNgFactory } from './app/app.server.module.ngfactory';

Activity

  1. modified the milestone: Backlog on Oct 16, 2019
  2. modified the milestones: Backlog, 9.0.x on Oct 17, 2019
  3. added and removed
    freq1: low
    on Oct 17, 2019
  4. vikerman commented on Oct 17, 2019

    @vikerman
    Contributor

    Part of Ivy opt out story for ssr.

  5. vikerman commented on Oct 31, 2019

    @vikerman
    Contributor

    For opting out let's ask the users to

    import { AppServerModuleNgFactory } from './app/app.server.module.ngfactory';
  6. self-assigned this
    on Nov 7, 2019
  7. alan-agius4 commented on Nov 7, 2019

    @alan-agius4
    CollaboratorAuthor

    Being addressed in angular/angular#33616

  8. alan-agius4 commented on Nov 8, 2019

    @alan-agius4
    CollaboratorAuthor

    Docs PR merged.

  9. angular-automatic-lock-bot commented on Dec 9, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. locked and limited conversation to collaborators on Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions