-
Notifications
You must be signed in to change notification settings - Fork 197
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
Using jsonld.js in Node-RED (with browserify) #128
Comments
I found a workaround which unfortunately requires to make small changes in the source code of jsonld.js.
After these changes, import the library with |
Using jsonld in a browserify-based build script does not works any more. This PR update the `browser` key in `package.json` in order force browserify to use the `dist` version for the browser (generated by webpack during release process). This solution provide browserify support without the needs to maintain complex configuration for both webpack and browserify. It could be less optimal in term of bundle size (for browserify use a bundled version of jsonld), but that is better than nothing and the modern minification tools may resolve this kind of optimization.
Hi @elf-pavlik, Sorry for the late answer (I've seen your notification but I should have been distracted at the time). |
Closing as very old and the landscape has changed -- or this may now potentially duplicate #399 in some way. |
Using jsonld in a browserify-based build script does not works any more. This PR update the `browser` key in `package.json` in order force browserify to use the `dist` version for the browser (generated by webpack during release process). This solution provide browserify support without the needs to maintain complex configuration for both webpack and browserify. It could be less optimal in term of bundle size (for browserify use a bundled version of jsonld), but that is better than nothing and the modern minification tools may resolve this kind of optimization.
This reverts commit 2add694.
I use the library as a part of my .js file which is compiled with browserify. The input file for browserify is below and the output file is called
bundle.js
:When I import
bundle.js
in .html file which is a part of any Node-RED plugin and doconsole.log(JSONLD);
, in the console I see an empty object, i.e.Object {}
. But if I import the file in a plain HTML outside of Node-RED environment, the library works correctly, i.e. it's imported as a function.Other libraries which I import in the same way, in example N3.js and axios, work correctly in both cases.
It's just my guess, but probably the issue is in the way the library is exported.
The text was updated successfully, but these errors were encountered: