Skip to content

Commit 01d41f6

Browse files
jgebhardtzpao
authored andcommitted
better error message for React EventPlugin order check
Ran into this while inadvertently requiring multiple React versions in a separate project (`require('react');` vs `require('React');`
1 parent 4c199da commit 01d41f6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/event/EventPluginRegistry.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ var EventPluginRegistry = {
176176
injectEventPluginOrder: function(InjectedEventPluginOrder) {
177177
invariant(
178178
!EventPluginOrder,
179-
'EventPluginRegistry: Cannot inject event plugin ordering more than once.'
179+
'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
180+
'once. You are likely trying to load more than one copy of React.'
180181
);
181182
// Clone the ordering so it cannot be dynamically mutated.
182183
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);

src/event/__tests__/EventPluginRegistry-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ describe('EventPluginRegistry', function() {
135135
EventPluginRegistry.injectEventPluginOrder(pluginOrdering);
136136
}).toThrow(
137137
'Invariant Violation: EventPluginRegistry: Cannot inject event plugin ' +
138-
'ordering more than once.'
138+
'ordering more than once. You are likely trying to load more than one ' +
139+
'copy of React.'
139140
);
140141
});
141142

0 commit comments

Comments
 (0)