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

zone-mix: Cannot read property 'eventNames' of undefined #31626

Closed
rezonant opened this issue Jul 9, 2019 · 2 comments
Closed

zone-mix: Cannot read property 'eventNames' of undefined #31626

rezonant opened this issue Jul 9, 2019 · 2 comments
Assignees
Milestone

Comments

@rezonant
Copy link

rezonant commented Jul 9, 2019

After upgrading from Angular 7 to Angular 8, our Electron builds break seemingly because of zone-mix:

polyfills.js:7635 Uncaught TypeError: Cannot read property 'eventNames' of undefined
    at eventTargetPatch (polyfills.js:7635)
    at polyfills.js:8003
    at Function.push../node_modules/zone.js/dist/zone-mix.js.Zone.__load_patch (polyfills.js:5274)
    at polyfills.js:8001
    at push../node_modules/zone.js/dist/zone-mix.js.performance (polyfills.js:5185)
    at Object../node_modules/zone.js/dist/zone-mix.js (polyfills.js:5187)
    at __webpack_require__ (runtime.js:84)
    at Module../src/polyfills-electron.ts (polyfills.js:8476)
    at __webpack_require__ (runtime.js:84)
    at Object.1 (polyfills.js:8551)

Taking a look at code, it is calling api.getGlobalObjects() and then accessing .eventNames,

    var _a = api.getGlobalObjects(), eventNames = _a.eventNames, ...

but the definition in effect is from zone-mix.js:644

        getGlobalObjects: function () { return undefined; },

The polyfills file in use for our Electron builds are:

import 'core-js/es7/reflect';
import 'zone.js/dist/zone-mix';  // Included with Angular CLI.
import 'zone.js/dist/zone-patch-electron';

The installed version of zone.js is 0.9.1.

I checked STANDARD-APIS.md and it does still recommend 'zone-mix' for Node-capable Electron builds (nodeIntegration = true). Tried removing zone-patch-electron but there's no change.

Is this still the recommended polyfills.ts setup for Angular apps running in Electron with Node integration turned on?

The error is not present if I opt for zone.js/dist/zone (the standard) as opposed to zone-mix, but I assume I'll only have Zone integration for browser APIs and not Node.js ones, so that's not ideal.

@JiaLiPassion
Copy link
Contributor

@rezonant , thanks for posting the issue, I will fix this bug, please rollback to zone.js 0.8.29 for now.

@JiaLiPassion JiaLiPassion transferred this issue from angular/zone.js Jul 18, 2019
@JiaLiPassion JiaLiPassion self-assigned this Jul 18, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 18, 2019
@ngbot ngbot bot added this to the needsTriage milestone Jul 18, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 22, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 23, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 23, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 23, 2019
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Jul 24, 2019
@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 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants