RussCoder / djvujs

DjVu.js is a program library for working with .djvu files online without any connection with the server. DjVu.js Viewer is a widget that allows viewing .djvu files right in the browser and can be easily embedded into any web page.
https://djvu.js.org/
Other
182 stars 36 forks source link

Import as module #34

Closed bilalhodzic closed 3 years ago

bilalhodzic commented 3 years ago

Is there a way I can use your code as a module in node.js? Or I need to insert your files into my project manually in one folder?

RussCoder commented 3 years ago

Hello! Right now there is not way to use it as a classical module (e.g. via npm). Moreover, the djvu.js bundle is an iife, not a umd, so you will not be able to require() it from your Node.js code.

You have to clone the project, and correct rollup.config.js to bundle to library as a umd module.

It should work on Node.js (but not completely, since it uses Canvas API for some operations), but I have never tested it myself on Node.js.

If you have some problems with creating a module from the code, write me here, I will help.