Open tobiasschweizer opened 4 years ago
I am still using this workaround to import jsonld: const jsonld = require('jsonld/dist/jsonld.js');
I tried to change this to import * as jsonld from 'jsonld';
but then I get
jsonld.js:1034 Uncaught ReferenceError: global is not defined at wrapper (jsonld.js:1034) at Object../node_modules/jsonld/lib/jsonld.js (jsonld.js:1073)
I am developing an Angular library that has an indirect dependency on
jsonld
. When I run my E2E tests that import elements of my Angular library I get:I found out that jsonld/dist/jsonld.js (distributed code: https://www.npmjs.com/package/jsonld/v/1.8.1) uses
window
:(window, function() {
(line 10).My understanding is that protractor is not aware of DOM objects that are normally available in client-side JS, so I added the following code in
protractor.conf.js
:Details can be found here: https://github.com/dasch-swiss/dsp-ui-lib/pull/124
Has anyone faced a similar issue with protractor and
jsonld
? If yes, how was it solved?