main.js:
import * as path from "https://deno.land/[email protected]/path/mod.ts";
const { a, ...rest } = { a: 3, b: "bar" };
console.log(a, rest);
CLI:
deno bundle main.js build/main.js
deno run build/main.js
results in:
error: Uncaught ReferenceError: __rest is not defined
_a = { a: 3, b: "bar" }, a = _a.a, rest = __rest(_a, ["a"]);
^
at execute (file:///tmp/TestProj/build/main.js:389:40)
at gExp (file:///tmp/TestProj/build/main.js:90:7)
at __instantiate (file:///tmp/TestProj/build/main.js:97:27)
at file:///tmp/TestProj/build/main.js:395:1
build/main.js emits:
System.register("file:///tmp/TestProj/main", [], function (exports_11, context_11) {
// ...
return {
// ...
execute: function () {
_a = { a: 3, b: "bar" }, a = _a.a, rest = __rest(_a, ["a"]); // this is the error cause
// ...
}
};
});
The __rest method is not defined anywhere in the emitted build output.
If I comment out the import statement on first line, it works again. deno bundle seems to change its build output conditionally dependent on whether the file is a script or a module - doesn't matter what exactly is imported.
Is this a deno bundle error or could it be more related to underlying TS SystemJS bundling?
Hrmmm... It shouldn't be doing that... it is down emitting syntax and not outputting the helpers.
I confirmed it is occurring on master, need to investigate.
Most helpful comment
Hrmmm... It shouldn't be doing that... it is down emitting syntax and not outputting the helpers.
I confirmed it is occurring on master, need to investigate.