Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup Build Errors: "this" has been rewritten to "undefined" and Circular Dependencies #610

Open
ophiryaniv-ts opened this issue Jul 3, 2024 · 1 comment
Labels

Comments

@ophiryaniv-ts
Copy link

ophiryaniv-ts commented Jul 3, 2024

Hi,
First of all, I want to thank you for the amazing work you’ve done with this library. It's been a fantastic tool for my project.

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

Could you please assist me in resolving these errors?

Thank you!

@werthdavid
Copy link
Member

Hey, I just look into it, the thing is that the code doesn't contain the source that is causing the problem, so the TypeScript compiler is creating that code... I'm wondering about the import as the ESM module is used. How do you import ZXing into your project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants