Skip to content

Event plugins names are mungled in Closure Compiler under advanced optimizations #9417

Closed
@roman01la

Description

@roman01la

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

What is the current behavior?
When React is compiled by Closure Compiler with advanced optimizations, names of injected event plugins are being mungled.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
Compile React with Closure Compiler directly from NPM.

What is the expected behavior?
The names of injected event plugins should not be mungled.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React v15.5.4
It didn't work in previous versions of React

Closure Compiler renames object properties, unless they are strings explicitly.
It happens because of the way how event plugins are injected here

  EventPluginHub.injection.injectEventPluginsByName({
    SimpleEventPlugin: SimpleEventPlugin,
    EnterLeaveEventPlugin: EnterLeaveEventPlugin,
    ChangeEventPlugin: ChangeEventPlugin,
    SelectEventPlugin: SelectEventPlugin,
    BeforeInputEventPlugin: BeforeInputEventPlugin,
  });

And later used here

  for (var pluginName in namesToPlugins) {
    var pluginModule = namesToPlugins[pluginName];
    var pluginIndex = eventPluginOrder.indexOf(pluginName);

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