I'm new to JavaScript and TypeScript and I'm using the zxing-js/library package in my project.
When I try to build my project with Rollup, I'm encountering the following errors:
(!) "this" has been rewritten to "undefined"
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/@zxing/browser/esm/readers/BrowserDatamatrixCodeReader.js
1: var __extends = (this && this.__extends) || (function () {
^
2: var extendStatics = function (d, b) {
3: extendStatics = Object.setPrototypeOf ||
...and 1 other occurrence
node_modules/@zxing/browser/esm/readers/BrowserPDF417Reader.js
1: var __extends = (this && this.__extends) || (function () {
^
2: var extendStatics = function (d, b) {
3: extendStatics = Object.setPrototypeOf ||
...and 1 other occurrence
node_modules/@zxing/browser/esm/readers/BrowserMultiFormatReader.js
1: var __extends = (this && this.__extends) || (function () {
^
2: var extendStatics = function (d, b) {
3: extendStatics = Object.setPrototypeOf ||
...and 1 other occurrence
...and 112 other files
(!) Circular dependencies
node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/ASCIIEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js
node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/Base256Encoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js
node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/C40Encoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js
node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/EdifactEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js
node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/X12Encoder.js -> node_modules/@zxing/library/esm/core/datamatrix/encoder/HighLevelEncoder.js
I experimented with few Rollup plugins like:
import typescript from '@rollup/plugin-typescript';
import { terser } from 'rollup-plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import commonJS from '@rollup/plugin-commonjs';
I'm not sure if this is a bug in my code or an issue with the zxing-js/library
package.
Could anyone help me understand and resolve these errors?
Thanks
Edit: I have notice that with both:
yarn rollup -c
and
yarn build
I am getting those errors