New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm package is broken. [EDIT: Does not work with browserify] #338
Comments
CKEditor is embedded in the core file, but I suppose not until further down. So the ordering of how things are stitched together doesn't work? |
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. |
Here is a repository with an example of a React component, server-side rendering and creating an instance in the browser. Hope that helps! Thanks, |
My steps:
Then in my app (using gulp and browserify):
When opening my app in the browser, I get:

If I embed the full version:
I get the same exception - so it's not the dependencies.

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:
The text was updated successfully, but these errors were encountered: