WebReflection/sqlite-worker

Resolve both `dir` and `library` options by default.

WebReflection opened this issue · 0 comments

Currently, there is a fancy dance to make sql.js usable as both ESM and CommonJS, but this doesn't easily scale:

  • I don't control https://sql.js.org/dist files, so the .js export might differ from its counter .wasm version provided online
  • there are current issues in loading the non debugging version of sql.js, and this might penalize both performance and overall size
  • changing the worker library option my result into importing the library twice

What to do

  • load sql.js a part, instead of bundling within this module
  • resolve automatically both dir and library options
  • instrument the module to be able to load sql.js properly (ugly dance with CommonJS)