Open vladinator1000 opened 2 months ago
I managed to get it to work by importing directly from the server folder
import { toBuffer } from 'qrcode/lib/server'
// Bonus promisification
export async function getQrCodeData(url: string): Promise<Buffer> {
return new Promise((resolve, reject) => {
function callback(err: Error, result: Buffer) {
if (err) {
reject(err)
} else {
resolve(result)
}
}
toBuffer(url, callback)
})
}
Hi there, it seems like the library doesn't work on Cloudflare even with the compatibility flags in wrangler.toml:
compatibility_flags = ["nodejs_compat_v2"]
Steps to reproduce:
npm start
localhost:8787
I can see that
toBuffer
is clearly exported from https://github.com/soldair/node-qrcode/blob/master/lib/server.js#L106 I wonder if the issue is due to the bundling process. When I enumerate the package keys like thisI get