-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use browserify to bundle index.js instead of webpack, don't include brace by default. #166
Comments
I think the only problem is with The offered I've created an issue at jsonlint: zaach/jsonlint#57 If the issue isn't resolved by |
Actually I'm pretty sure that's not the only problem. Browserify is not building the lib, even when you use I have tried all kinds of combinations, using gulp, using |
Ironically enough, version 3.2.0 works perfectly with Browserify. |
Yes, there was quite a big change in the code structure, hence the 4.0.0 versioning :). The code was changed from AMD to CommonJS modules, and now uses I totally agree with you that the need to use Did you use the source code cloned from github to do the custom build? Or did you use the package installed via npm (which is currently missing the |
I think I built it from github, the npm package is broken. If you build with If you build with To make sure I'm not doing something wrong, try using the output of the examples in the README, to create a JSONEditor object. |
Sorry I mean't hm that's odd. I just did the following to test this, working just fine:
|
Does the "code" mode work too? |
Tested that too, works indeed fine. The generated jsoneditor.custom.js is ~887 KB |
@nfvs Did you already figure out what was going wrong with browserify? |
Not really, building a single |
I still have to fix the |
I've released v4.1.3, which fixes the broken dependencies of jsonlint. You should now be able to use browserify the regular way, without need for special command line options |
Ah, the common "screw it, I'll use my own fork!" workaround :-) Thanks for the work, I will try this first thing tomorrow. |
yes, don't we all love github? ;) I will do a PR to the original |
Still getting a |
Thanks for testing. This warning occurs when brace is excluded from the jsoneditor bundle. In v3 you had to load Ace separately, but in v4 it's bundled inside jsoneditor (it will not recognize any globally loaded Ace editor). Can you get a custom build of jsoneditor working outside of your project? Like creating a clone of the github project in a tmp directory on your computer, and then running browserify in the root of the project:
Then adjust one of the examples to use |
When doing that separately it works, and the examples also work, but in my own project (it's using grunt-browserify to build a vendor.js) it's failing for some reason. I'm trying to find out why. |
Ok I think I found the problem. When I include both brace and jsoneditor in the same
Seems it's a brace error, not jsoneditor, but this is weird especially because if I remove This is apparently not a problem if we're not including brace ourselves outside of jsoneditor, but if for some reason we are (e.g. for using a different theme in ace), then this error pops up. Still not 100% sure this is due to some error on my part, I'm still trying to find that out, but if not it may be useful to allow overriding of the (br)ace object in jsoneditor, the same way it happens with Backbone.js:
|
That's a good idea, thanks. |
I managed to fix that problem with some browserify magic btw, but allowing overrides may still be a good idea. Perhaps by first checking if a |
The default build in
dest/jsoneditor.js
includesbrace
andjsonlint
, which seems to create many problems when using browserify to bundle jsoneditor due to some missing libs (e.g. there's nofile
module with browserify, which makes jsonlint choke).Apparently webpack doesn't easily support excluding libraries, so perhaps using browserify to create a clean
jsoneditor.js
without bundled dependencies would be best. This resultingjsoneditor.js
contents can either go intoindex.js
(which browserify tries to include by default), or into a new file indist/
, which package.json can reference with themain
option.The text was updated successfully, but these errors were encountered: