Skip to content

Line after console.log gets skipped. #9492

Description

@VimHax

Describe the bug

<script lang="ts">
	console.log(null!, new Date());
	console.log('Foo');
	console.log('Bar');
</script>

When executing this code, Foo does not get printed but Bar does. It seems like no matter what the line after the initial console.log is, it gets skipped. Looking at the generated code the Foo line isn't even there.

import {S as s, i as o, s as t} from "../chunks/index.847936d9.js";
function l(e) {
    return console.log(null, new Date),
    console.log("Bar"),
    []
}
class r extends s {
    constructor(n) {
        super(),
        o(this, n, l, null, t, {})
    }
}
export {r as default};

Reproduction

https://github.com/VimHax/Svelte-Bug

This bug only happens in a release build. Simply run the following commands after cloning.

npm install
npm run build
npm run preview

When you load the website, both in the browser console and server console, you will not see Foo getting printed. The logs should look something like below;

null 2023-03-23T08:37:20.392Z
Bar

Logs

No response

System Info

System:
    OS: Linux 6.1 Fedora Linux 37 (Workstation Edition)
    CPU: (12) x64 Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
    Memory: 6.28 GB / 15.55 GB
    Container: Yes
    Shell: 3.6.0 - /usr/bin/fish
  Binaries:
    Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
  Browsers:
    Firefox: 110.0
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0 
    @sveltejs/kit: ^1.13.0 => 1.13.0 
    svelte: ^3.57.0 => 3.57.0 
    vite: ^4.2.1 => 4.2.1

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions