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 #1466

Closed
soelen opened this issue Sep 1, 2021 · 2 comments
Closed

this has been rewritten to undefined #1466

soelen opened this issue Sep 1, 2021 · 2 comments

Comments

@soelen
Copy link

soelen commented Sep 1, 2021

I recently integrated redux-toolkit in one of my projects and my rollup based building setup throws a warning out:

(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules\@reduxjs\toolkit\dist\redux-toolkit.esm.js
1: var __extends = (this && this.__extends) || (function () {
                    ^
2:     var extendStatics = function (d, b) {
3:         extendStatics = Object.setPrototypeOf ||
...and 5 other occurrences

Perhaps this is nothing to be concerned about but I decided to create an Issue just in case.

I also integrated redux-toolkit in one of my public projects in order to make this issue reproduceable:

How to reproduce

Files of interest

My whole redux setup is inside the store folder. I use Webcomponents/Lit to establish a component architecture. My base class page-element is subscribed to the store and some of my pages make use of it.

@phryneas
Copy link
Member

phryneas commented Sep 1, 2021

That's nothing to worry about, that's just one bundler complaining about code from another bundler that is a bit defensive ;)

Nothing of that has been written by hand by us and it will be working 100%

@soelen soelen closed this as completed Sep 1, 2021
@soelen
Copy link
Author

soelen commented Sep 1, 2021

Thanks a bunch @phryneas! For future googlers: I just put this in the rollup option onwarn prop; based on this solution:

// ...
export default {
  // ...
  onwarn(warning, warn) {
      if (warning.code === 'THIS_IS_UNDEFINED') return;
      warn(warning);
  },
  plugins: [
  // ...

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