deno icon indicating copy to clipboard operation
deno copied to clipboard

When executing deno bundle, tree shaking fails.

Open masx200 opened this issue 2 years ago • 1 comments

When executing deno bundle, tree shaking fails.

deno 1.25.1 (release, x86_64-pc-windows-msvc) v8 10.6.194.5 typescript 4.7.4

//baz.ts
import { foo } from "./test.ts";
console.log(new foo());
//test.ts
var aaaa = { bbb: "bar" };
export { aaaa };
export class foo {
  hello() {
    console.log("foo");
  }
}
export { isIP } from "https://deno.land/[email protected]/node/internal/net.ts";

deno bundle "C:\Documents\test\baz.ts" -- out.js

correct output:

class foo {
    hello() {
        console.log("foo");
    }
}
console.log(new foo());

wrong output:

// deno-fmt-ignore-file
// deno-lint-ignore-file
// This code was bundled using `deno bundle` and it's not recommended to edit it manually
//............
//.............
//........to many code
codes.ERR_UNKNOWN_ENCODING = ERR_UNKNOWN_ENCODING;
hideStackFrames(function genericNodeError(message, errorProperties) {
    const err = new Error(message);
    Object.assign(err, errorProperties);
    return err;
});
const v4Seg = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])";
const v4Str = `(${v4Seg}[.]){3}${v4Seg}`;
new RegExp(`^${v4Str}$`);
const v6Seg = "(?:[0-9a-fA-F]{1,4})";
new RegExp("^(" + `(?:${v6Seg}:){7}(?:${v6Seg}|:)|` + `(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` + `(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` + `(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` + `(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` + `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` + `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` + `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` + ")(%[0-9a-zA-Z-.:]{1,})?$");
Symbol("normalizedArgs");
class foo {
    hello() {
        console.log("foo");
    }
}
console.log(new foo());

masx200 avatar Sep 07 '22 10:09 masx200

Same issue here image

sant123 avatar Sep 10 '22 02:09 sant123

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 09 '22 07:11 stale[bot]

@ry

masx200 avatar Nov 09 '22 08:11 masx200