Skip to content

*Event/HTML*Element is not defined error in server build #8412

@kevinbuhmann

Description

@kevinbuhmann

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Angular CLI: 1.5.0
Node: 8.7.0
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.2
typescript: 2.4.2
webpack: 3.8.1

Repro steps.

  1. Create new app with ng new ....
  2. Follow https://github.com/angular/angular-cli/wiki/stories-universal-rendering.
  3. Add @HostListener('window:click') click(event: MouseEvent) { } in the app.component.ts.
  4. Run yarn run build:ssr && yarn run serve:ssr.

Repro: https://github.com/kevinphelps/angular-cli-issue-8412-repro

The log given by the failure.

ReferenceError: MouseEvent is not defined
    at C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:12684
    at Object.wQAS (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:12867)
    at l (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:149)
    at Object.aR8+ (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:7591)
    at l (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:149)
    at Object.bNRb (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:7978)
    at l (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:149)
    at Object.JwoV (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:995)
    at l (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:149)
    at Object.Zq8w (C:\Users\Kevin\Desktop\server-test\dist\server.js:129629:7299)

Desired functionality.

The use of Event, MouseEvent, KeyboardEvent, HTMLElement, etc. interfaces should not break the server builds.

Mention any other details that might be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions