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

Build optimization breaks code (Removes necessary break from switch) #12794

Closed
7 tasks done
DeepDoge opened this issue Apr 8, 2023 · 3 comments
Closed
7 tasks done

Build optimization breaks code (Removes necessary break from switch) #12794

DeepDoge opened this issue Apr 8, 2023 · 3 comments
Labels
bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@DeepDoge
Copy link

DeepDoge commented Apr 8, 2023

Describe the bug

Build optimization is removing break keyword from switch statement where it shouldn't.
I'm not sure if this is a Vite, Rollup or Typescript issue.

Reproduction

https://github.com/DeepDoge/vite-breaks-switch/blob/master/src/main.ts

Steps to reproduce

  • Clone the repo.
  • npm i
  • npm run dev
    • Console logs "normally it should exit after this, without any errors"
  • npm run build
  • npm run preview
    • Console logs "normally it should exit after this, without any errors"
    • Then throws "error 3" (this shouldn't happen)

System Info

System:
    OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 5.93 GB / 15.44 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 18.14.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.3.1 - /usr/local/bin/npm
  npmPackages:
    vite: ^4.2.0 => 4.2.1

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

This is a bug in rollup.
Here's a reproduction only with rollup: rollup repl
Would you report to rollup?

@sapphi-red sapphi-red added bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority) labels Apr 8, 2023
@DeepDoge
Copy link
Author

DeepDoge commented Apr 8, 2023

@sapphi-red thank you, i will

@DeepDoge DeepDoge closed this as completed Apr 8, 2023
@DeepDoge
Copy link
Author

DeepDoge commented Apr 8, 2023

opened the issue here rollup/rollup#4930

@DeepDoge DeepDoge reopened this Apr 8, 2023
@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

3 participants