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: this has been rewritten to undefined #84

Open
jtlapp opened this issue Apr 19, 2022 · 0 comments
Open

Rollup: this has been rewritten to undefined #84

jtlapp opened this issue Apr 19, 2022 · 0 comments

Comments

@jtlapp
Copy link

jtlapp commented Apr 19, 2022

Rollup was giving me this warning for http-status-codes/build/es/index.js:

bundles src/frontend/main.ts → public/build/bundle.js...
LiveReload enabled
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/http-status-codes/build/es/index.js
1: var __assign = (this && this.__assign) || function () {
                   ^
2:     __assign = Object.assign || function(t) {
3:         for (var s, i = 1, n = arguments.length; i < n; i++) {
...and 1 other occurrence

To eliminate it, I added the following line to my rollup.config.js:

export default {
    // ...
    context: {}, // needed for loading http-status-codes
    // ...
}

But ideally, the module shouldn't be referencing this from the top level.

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

No branches or pull requests

2 participants