JavaScript SDK doesn't play nice with nextjs webpack
So I tried the JavaScript SDK (npm install pgml, version 0.8.0) with Vercel, specifically next.js, which uses webpack to build and distribute the app.
Webpack typically should be able to collect native modules, when using node-loader, but in the case of nextjs at least it was placing it in the wrong directory and I kept getting module not found. I'm not sure if it's a bug with the webpack configuration, with nextjs, or with our SDK.
It would be nice to have a few example apps that use common frameworks like nextjs, express and tools like webpack to make sure that our package is usable in typical settings.
Started playing around with Cloudflare workers (JavaScript as well). It's using I believe esbuild and also they "nerf" node I think and remove some APIs. I have this code in my src/worker.js:
import pgml from 'pgml'
and I'm getting these errors:
✘ [ERROR] Could not resolve "os"
node_modules/pgml/index.js:1:19:
1 │ const os = require("os")
and an error like the one below for each arch we support (telling me it tried to load all of them):
✘ [ERROR] No loader is configured for ".node" files: node_modules/pgml/dist/x86_64-apple-darwin-index.node
node_modules/pgml/index.js:11:25:
11 │ const pgml = require("./dist/x86_64-apple-darwin-index.node")