LDflex / Query-Solid

Simple access to data in Solid pods through LDflex expressions
https://solid.github.io/query-ldflex/
MIT License
66 stars 15 forks source link

Comunica (sub-)dependencies missing #74

Open renyuneyun opened 11 months ago

renyuneyun commented 11 months ago

I'm trying to use LDflex with Solid, on a Vue project. The base LDflex library works fine. Then I followed the README of Query-Solid (this repo), installed @solid/query-ldflex, and copied the example code to a separate file. However, after importing that code file, the following errors emerge in the build tool:

✘ [ERROR] Could not resolve "@comunica/actor-rdf-join-symmetrichash"

    node_modules/@solid/query-ldflex/node_modules/@ldflex/comunica/lib/comunica-engine.js:78:157:
      78 │ ... new (require('@comunica/actor-rdf-join-symmetrichash').ActorRdfJoi...
         ╵                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@comunica/actor-rdf-join-symmetrichash" as external to
  exclude it from the bundle, which will remove this error. You can also surround
  this "require" call with a try/catch block to handle this failure at run-time
  instead of bundle-time.

✘ [ERROR] Could not resolve "@comunica/actor-rdf-join-nestedloop"

    node_modules/@solid/query-ldflex/node_modules/@ldflex/comunica/lib/comunica-engine.js:82:154:
      82 │ ...= new (require('@comunica/actor-rdf-join-nestedloop').ActorRdfJoinN...
         ╵                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@comunica/actor-rdf-join-nestedloop" as external to exclude
  it from the bundle, which will remove this error. You can also surround this
  "require" call with a try/catch block to handle this failure at run-time instead
  of bundle-time.
...

(I have truncated the error. Lots of more lines with similar things, all related to some comunica modules.)

The error message seems to indicate these lines are dynamic imports, that are not properly dealt with?

I'm using Vite as build tool, and uses import statements rather than require function. The default configuration should convert all import to require, if I understand correctly, so probably unrelated to ES module.

See https://github.com/renyuneyun/minimal-reproduction/tree/master/ldflex-getting-started for a MRE. Import is controlled in the beginning of file https://github.com/renyuneyun/minimal-reproduction/blob/master/ldflex-getting-started/src/App.vue