"(!) `this` has been rewritten to `undefined`" error when bundling a TypeScript IIFE
JJ opened this issue · 1 comments
JJ commented
This the relevant rollup config:
{
input: fileName,
output: {
file: "build/js/bubblewrap.js",
format: "iife",
name: "bubblewrap"
},
plugins: [
commonjs(),
nodeResolve(),
sucrase({
exclude: ["node_modules/**"],
transforms: ["typescript"]
})
]
}And this are the warnings:
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/@msgpack/msgpack/dist.es5+esm/decodeAsync.mjs
1: var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
^
2: function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3: return new (P || (P = Promise))(function (resolve, reject) {
...and 3 other occurrences
node_modules/@msgpack/msgpack/dist.es5+esm/Decoder.mjs
1: var __extends = (this && this.__extends) || (function () {
^
2: var extendStatics = function (d, b) {
3: extendStatics = Object.setPrototypeOf ||
...and 11 other occurrences
node_modules/@msgpack/msgpack/dist.es5+esm/utils/stream.mjs
1: // utility for whatwg streams
2: var __generator = (this && this.__generator) || function (thisArg, body) {
^
3: var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4: return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
...and 5 other occurrences
I have the impression this is related to #104, but it might be totally different. Any idea?
gfx commented
It seems a bug in rollup. Please file an issue on the rollup repo. Or, just use webpack.