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

"this" has been rewritten to "undefined" warning during the Rollup build (ESM) #216

Closed
cjnoname opened this issue Aug 1, 2024 · 5 comments

Comments

@cjnoname
Copy link

cjnoname commented Aug 1, 2024

Hi,

We encountered an issue where tss-react gives me a warning during the ESM build with Rollup.

Here is the detail of the warning:

(!) "this" has been rewritten to "undefined"
https://rollupjs.org/troubleshooting/#error-this-is-undefined
node_modules/tss-react/esm/tss.js
1: /* eslint-disable @typescript-eslint/ban-types */
2: var __rest = (this && this.__rest) || function (s, e) {
^
3: var t = {};
4: for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
...and 1 other occurrence
node_modules/tss-react/esm/withStyles.js
1: var __rest = (this && this.__rest) || function (s, e) {
^
2: var t = {};
3: for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)

The link below serves as a reference for this error:
https://rollupjs.org/troubleshooting/#error-this-is-undefined

@cjnoname
Copy link
Author

cjnoname commented Aug 1, 2024

Also below with the same issue:

node_modules/tss-react/esm/withStyles.js
1: var __rest = (this && this.__rest) || function (s, e) {
^
2: var t = {};
3: for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)

@garronej
Copy link
Owner

garronej commented Aug 1, 2024

Hello, thanks for reporting. Do you experience any bug besides this warning?

@cjnoname
Copy link
Author

cjnoname commented Aug 1, 2024

Hello, thanks for reporting. Do you experience any bug besides this warning?

Not sure mate, we haven't tried, but this is the only warning we had during the build

garronej added a commit that referenced this issue Aug 1, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
lucasfernog Lucas Fernandes Nogueira
@garronej
Copy link
Owner

garronej commented Aug 1, 2024

Well, this warning sucks because this is perfectly valid code.
Anyway I changed the compilation target for the ESM distribution in tss-react@4.9.12.

Thanks for reporting

@garronej garronej closed this as completed Aug 1, 2024
@cjnoname
Copy link
Author

cjnoname commented Aug 1, 2024

Well, this warning sucks because this is perfectly valid code. Anyway I changed the compilation target for the ESM distribution in tss-react@4.9.12.

Thanks for reporting

Thanks for your quick fix mate

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

No branches or pull requests

2 participants