You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code that is imported pollutes the local scope but only when compiled. For example, the following code works when called with deno run but does not work when the executable produced by deno compile is ran.
test.ts
importj2from'./test2.ts'//@ts-ignoreconsole.log(j2===JSON)if(globalThis.JSON===JSON)console.log('Locally scoped JSON has not been changed.')elseconsole.log('Locally scoped JSON has been changed!')console.log(JSON.stringify({}))
test2.ts
exportdefaultclassJSON{}
> deno run test.ts
false
Locally scoped JSON has not been changed.
{}
> deno compile test.ts
> ./test.exe
true
Locally scoped JSON has been changed!
error: TypeError: JSON.stringify is not a function
at file://$deno$/bundle.js:12:18
The text was updated successfully, but these errors were encountered:
$ deno bundle -q test.ts
class JSON {
}
console.log(JSON === JSON);if (globalThis.JSON === JSON) console.log('Locally scoped JSON has not been changed.');else console.log('Locally scoped JSON has been changed!');
console.log(JSON.stringify({
}));
deno 1.13.2 works as expected
```sh
$ deno bundle -q test.ts
class JSON1 {
}
console.log(JSON1 === JSON);
if (globalThis.JSON === JSON) console.log('Locally scoped JSON has not been changed.');
else console.log('Locally scoped JSON has been changed!');
console.log(JSON.stringify({
}));
```
deno 1.14.2 (currently latest) has this bug
```sh
$ deno bundle -q test.ts
class JSON {
}
console.log(JSON === JSON);
if (globalThis.JSON === JSON) console.log('Locally scoped JSON has not been changed.');
else console.log('Locally scoped JSON has been changed!');
console.log(JSON.stringify({
}));
```
deno 1.14.0
Code that is imported pollutes the local scope but only when compiled. For example, the following code works when called with
deno run
but does not work when the executable produced bydeno compile
is ran.test.ts
test2.ts
The text was updated successfully, but these errors were encountered: