Skip to content

Using jsonld.js in Node-RED (with browserify) #128

Closed
@KMax

Description

@KMax

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:

"use strict";

... // other imports via require(...);
global.JSONLD = require('jsonld');

When I import bundle.js in .html file which is a part of any Node-RED plugin and do console.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions