Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Function declarations in lib/keys.js broken when Webpack is used #194

@ivankashtanov

Description

@ivankashtanov

Webpack turns function declarations of create in lib/keys.js into function expressions. The relevant part looks like this after Webpack processing:

if (typeof _Symbol !== 'undefined') {
    var _create = function _create(name) {
        return _Symbol(name);
    };
} else {
    var _create2 = function _create2(name) {
        return '_zone$' + name;
    };
}

var commonKeys = {
    addEventListener: create('addEventListener'),
    removeEventListener: create('removeEventListener')
};

As a result, create is not defined when used for properties of commonKeys and it breaks initialzation as far as I understand.
I'm not sure if it's zone.js bug or Webpack's, but JSHint also gives a warning on these two declarations so I decided to report it here. Here's the warning text:
Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function. (W082)

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