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: the bundle file does not have the same behavior as the source #9450

Closed
SteelAlloy opened this issue Feb 8, 2021 · 2 comments
Closed
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)

Comments

@SteelAlloy
Copy link

Let's consider these three files:

// three.ts
export let value = "old"

export function setValue() {
  value = "new";
}
// two.ts
export { value, setValue } from "./three.ts";
// one.ts
import { value, setValue } from "./two.ts";

setValue();
console.log(value)

If we run one.ts:

$ deno run one.ts 
new

If we run bundle.js:

$ deno bundle one.ts bundle.js

$ deno run bundle.js
old

The result is different.

Bundled file:

// bundle.js
let value = "old";
const value1 = value;
function setValue() {
    value = "new";
}
const setValue1 = setValue;
setValue1();
console.log(value1);

Tested on:

  • deno 1.7.1
  • Windows, Linux
@kitsonk kitsonk added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels Feb 8, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Feb 8, 2021

cc/ @kdy1

kdy1 added a commit to kdy1/swc that referenced this issue Feb 10, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Feb 16, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Feb 19, 2021
@bartlomieju
Copy link
Member

Fixed in 1.8

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 swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

3 participants