Skip to content

Rollup: this has been rewritten to undefined #84

@jtlapp

Description

@jtlapp

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions