Skip to content

npm package is broken. [EDIT: Does not work with browserify] #338

Description

@andreasheim

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:
screen shot 2015-09-04 at 6 25 33 pm

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.
screen shot 2015-09-04 at 6 26 28 pm

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:

screen shot 2015-09-04 at 6 43 11 pm
screen shot 2015-09-04 at 6 42 32 pm

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions