dokieli icon indicating copy to clipboard operation
dokieli copied to clipboard

ReferenceError: DO is not defined

Open white-gecko opened this issue 6 years ago • 6 comments

I've tried to include dokieli in my page but I receive

ReferenceError: DO is not defined

on the console. My code is in my repository in an extra branch: https://github.com/white-gecko/natanael.arndt.xyz/tree/feature/dokieli

I've included dokieli.js and dokieli.css with webpack and added some RDFa to the relevant articles: (e.g. https://natanael.arndt.xyz/bib/arndt-n-2017--quitstack) I've added the RDFa locally as can be seen in my repositroy: https://github.com/white-gecko/natanael.arndt.xyz/commit/ea86847e97c433a753644591bcd84719d4bec087

…
<div prefix="dct: http://purl.org/dc/terms/" about="page.rdf" class="post" typeof="http://schema.org/CreativeWork http://purl.org/net/nknouf/ns/bibtex#InProceedings">
  <header class="post-header">
    <h2 property="dct:title">A Method for Distributed and Collaborative Curation of RDF Datasets Utilizing the Quit Stack</h2>
    …
  </header>

  <article about="" class="post-content" typeof="http://schema.org/Article">
      <h3>Abstract</h3>
      <p>…</p>
  </article>
</div>
…

So I guess this is a bug. If it is me, who is to stupid to use it please pardon me.

white-gecko avatar Feb 27 '19 14:02 white-gecko

I adopted the RDFa stuff as I've seen it in https://dokie.li/new

white-gecko avatar Feb 27 '19 14:02 white-gecko

I think you want to import dokieli/scripts/dokieli.js (which is the distribution)

csarven avatar Feb 27 '19 14:02 csarven

Sort of related: I'm curious if a class of issues around prefixes will arise ie. if dokieli is (mistakenly) assuming some prefixes are in the host document, but it is not. Any way, we can iron that out if it comes up (in a separate issue).

csarven avatar Feb 27 '19 14:02 csarven

I tried that already, but then I received the following message on executing npx webpack (while importing dokieli/src/dokieli.js compiled without error):

ERROR in ./node_modules/dokieli/scripts/dokieli.js
Module not found: Error: Can't resolve 'TextEncoder' in '…/node_modules/dokieli/scripts'
 @ ./node_modules/dokieli/scripts/dokieli.js 1:135-157
 @ ./src/index.js

ERROR in ./node_modules/dokieli/scripts/dokieli.js
Module not found: Error: Can't resolve 'fetch' in '…/node_modules/dokieli/scripts'
 @ ./node_modules/dokieli/scripts/dokieli.js 1:100-116
 @ ./src/index.js

ERROR in ./node_modules/dokieli/scripts/dokieli.js
Module not found: Error: Can't resolve 'window' in '…/node_modules/dokieli/scripts'
 @ ./node_modules/dokieli/scripts/dokieli.js 1:82-99
 @ ./src/index.js

white-gecko avatar Feb 27 '19 14:02 white-gecko

Hmm, I'm a bit unclear on the process. The initial ReferenceError was probably because https://natanael.arndt.xyz/bib/arndt-n-2017--quitstack didn't include dokieli.js in the source no? Are you trying to rebuild dokieli during your own webpack execution (for that see dokieli's webpack.config.js perhaps for hints?), or only want to include dokieli's distribution in your HTML, or possibly both rebuilding and including the distribution? Should it be part of your JS or no? I'm not getting the full picture..

csarven avatar Feb 27 '19 15:02 csarven

Yes, https://natanael.arndt.xyz/bib/arndt-n-2017--quitstack does not include dokieli.js. But the whole issue is about my local trials with the branch (https://github.com/white-gecko/natanael.arndt.xyz/tree/feature/dokieli) where I've added dokieli and tried it locally before I deploy it to my live webpage. If you like I can also see if I can deploy this branch somewhere as well.

I try to include dokieli, just as I include bootstrap and fontawesome into my webpage using webpack. So I I think the third option "rebuilding and including the distribution" fits best.

white-gecko avatar Feb 27 '19 15:02 white-gecko