Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event type in button causes error during nodejs precompilation #306

Closed
jeffbcross opened this issue Apr 14, 2016 · 1 comment · Fixed by #307
Closed

Event type in button causes error during nodejs precompilation #306

jeffbcross opened this issue Apr 14, 2016 · 1 comment · Fixed by #307
Assignees

Comments

@jeffbcross
Copy link

Note: for support questions, please use one of these channels:
https://github.com/angular/material2/blob/master/CONTRIBUTING.md#question.
This repository's issues are reserved for feature requests and bug reports.

  • Do you want to request a feature or report a bug?

Bug

  • What is the current behavior?

If I use prerender libraries for angular universal to precompile a component that uses MdButton, it fails as soon as the compiled button.js module is loaded because of the presence of a global Event object that doesn't exist in node.

This line is the offender: https://github.com/angular/material2/blob/d4a3cde52ba736da64285bdfaf039129d0dd8312/src/components/button/button.ts#L122

Because of the HostListener decorator, the type information for that method gets preserved as follows:

__decorate([
        core_1.HostListener('click', ['$event']),
        __metadata('design:type', Function),
        __metadata('design:paramtypes', [Event]), // <-- there's the problem
        __metadata('design:returntype', void 0)
    ], MdAnchor.prototype, "haltDisabledEvents", null);
  • Which version of Angular and Material, and which browser and OS does this issue affect?
    Did this work in previous versions of Angular / Material?
    Please also test with the latest stable and snapshot versions.

Beta.1 and Beta.2.

  • Other information
    (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix)
ReferenceError: Could not require 'angular-cli-build.js': Event is not defined
    at project/node_modules/@angular2-material/button/button.ts:121:37
    at Object.<anonymous> (project/node_modules/@angular2-material/button/button.ts:94:1)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (project/src/client/app/issue-cli.ts:7:1)
    at Module._compile (module.js:413:34)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants