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

Deno.bundle fails when the files don't export anything #8803

Closed
ebebbington opened this issue Dec 17, 2020 · 2 comments
Closed

Deno.bundle fails when the files don't export anything #8803

ebebbington opened this issue Dec 17, 2020 · 2 comments
Labels
bug Something isn't working correctly public API related to "Deno" namespace in JS

Comments

@ebebbington
Copy link
Contributor

Reproduction

// a.ts
const [d, o] = await Deno.bundle("./my_ts.ts")
// my_ts.ts
function greet(name: string): string {
  return "Hello, " + name;
}

Output:

error: Uncaught (in promise) AssertionError: Assertion failed.
    at Object.assert (deno:cli/rt/06_util.js:33:13)
    at Object.bundle (deno:cli/rt/40_compiler_api.js:85:10)

Add export before the function declaration in my_ts.ts, run again, and it works

@kitsonk kitsonk added bug Something isn't working correctly public API related to "Deno" namespace in JS labels Dec 18, 2020
@kitsonk
Copy link
Contributor

kitsonk commented Dec 18, 2020

It isn't the lack of exports... if you actually invoked the function greet() somewhere it would bundle fine.

We could react better, the the proper emit of this bundle, with dead-code elimination/tree branching is an empty string. We double check for undefined or null, instead of falsey values.

I don't think it is an issue with #8799 but will ensure I double check that.

@satyarohith
Copy link
Member

This isn't an issue anymore. Deno.emit("./source.ts", { bundle: "esm" }) produces an empty string with the above source examples as one would expect.

@kitsonk kitsonk closed this as completed Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly public API related to "Deno" namespace in JS
Projects
None yet
Development

No branches or pull requests

3 participants