Compatibility issue with Sentry + Next.js
When using with Next.js 15, if Sentry is added to the project then rendering fails with Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
The error can be resolved by upgrading Stencil. PR to follow shortly.
See rnbrady/qrcode-sentry-issue for reproduction. Before vs after adding Sentry:
The issue seems to be specific to Next.js or React as I'm unable to reproduce it by adding Sentry to the vanilla HTML + Js demo pages.
Hey @rnbrady
Since the PR hasn’t been merged in over 3 months, would you consider publishing your fork to npm?
Right now the GitHub repo is missing the dist/ folder, so it can’t be used directly as a dependency.
@frederichoule the best solution is to vendor the package with the changes you want. You build the package (npm run build) and compress it (npm pack) into a tarball which you copy into your project (e.g. in a top level vendor folder) and commit to git.
Then you npm install or pnpm add that tarball, after which you package.json will look like this:
"dependencies": {
"@bitjson/qr-code": "file:vendor/bitjson-qr-code.tar.gz",
}
Your package manager extracts the tarball into node_modules.
@frederichoule the best solution is to vendor the package with the changes you want. You build the package (
npm run build) and compress it (npm pack) into a tarball which you copy into your project (e.g. in a top levelvendorfolder) and commit to git.Then you
npm installorpnpm addthat tarball, after which youpackage.jsonwill look like this:"dependencies": { "@bitjson/qr-code": "file:vendor/bitjson-qr-code.tar.gz", }Your package manager extracts the tarball into
node_modules.
Thanks! I will try that.