Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
npm package is broken. [EDIT: Does not work with browserify] #338
Then in my app (using gulp and browserify):
If I embed the full version:
Looking at the source, I see this:
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
and then further down
Yet then it still fails here:
I wouldn't say the npm package is "broken".
In general, to bundle AlloyEditor's files inside your application does not make much sense and we don't recommend you to do it for at least these reasons:
Now about the issue:
That is what --require/--external and factor-bundle are for.
There's also the option of making
For an example see how jQuery works on the server.
Sure, thanks for the heads up!
Sounds good for me. Would you guys like to contribute code which fixes this issue?
So I see that
Yes, I'm aware that the library (in particular the ckeditor dependency) is massive. I didn't go in detail there, it will/would go into a vendor/library bundle, not the core app.js.
In our environment, all files are hashed. So libraries need to be static and not load other files dynamically merely based on a base folder. I had hoped that since I discovered alloy on npm it would include a version of ckeditor that would work with these requirements.
I'd be willing to contribute to fix this issue, but I'm not sure if I'll have the time in the short term :(
Well, if you know the language of the browser in advance, or if you don't have to support multiple languages, then you can provide the needed language file (for example English one) explicitly. As far as I remember the config file too... so in general the editor won't load any additional files dynamically.
About the issue, here is what the editor does - in browser environment, it exposes all the needed API. In NodeJS, it exports an object, so you are able to render the page on the server and to write some unit tests. However, with browserify in the moment of initialization both are available - module.exports and window. This is what is not expected currently.