Closed
Description
My steps:
$ npm install alloyeditor --save
alloyeditor@0.5.2 node_modules/alloyeditor
Then in my app (using gulp and browserify):
AlloyEditor = require 'alloyeditor'
When opening my app in the browser, I get:
If I embed the full version:
AlloyEditor = require 'alloyeditor/dist/alloy-editor/alloy-editor-all'
I get the same exception - so it's not the dependencies.
Looking at the source, I see this:
(function() {
'use strict';
(function () {
'use strict';
/**
* AlloyEditor static object.
*
* @class AlloyEditor
* @type {Object}
*/
var AlloyEditor = {
// ...
}
})();
var React = (function() {
return (0, eval)('this').React;
}());
if (typeof React === 'undefined') {
React = AlloyEditor.React;
}
So that nested 2nd closure is closed before doing the React check. At which point AlloyEditor has not been declared since this code runs outside the nested closure.
I can get past that by using
var React = require('react');
and then further down
require('./ckeditor');
Yet then it still fails here: