1

I am trying: to use libsquoosh with Nginx njs scripting module for some fancy on-the-fly image cashing\processing for the internal OSM tile server. To use Node libraries in the njs environment I am trying to follow Nginx how-to, But can't seem to go around one or other global(?) library not browserify to bundle.

load.js: global.ImagePool = require('@squoosh/lib').ImagePool;

Error: npx browserify load.js -o bundle.js -d Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat './worker_threads'

In separation, both using library in browser\Node app, and using njs to dynamically fetch images and return blobs at dynamic paths is not hard, but this leaks into some arcane(for me) territory which I do not understand. Right now my working theory is to find where node stores its global modules and try to feed it to browserify, which seems unproductive.

Also, I have some suspicions about if it is even possible\makes sence with njs compliances to start with:

ECMAScript 5.1 (strict mode) with some ECMAScript 6

I also found this stackoverflow thread that proposes a much easier way: to use locations redirects to wrap other services, but that kinda defeats the point of having a built-in scripting language.

0 Answers0