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

Missmatch between dev / build for typescript files with ?url #16716

Closed
7 tasks done
anuejn opened this issue May 18, 2024 · 2 comments
Closed
7 tasks done

Missmatch between dev / build for typescript files with ?url #16716

anuejn opened this issue May 18, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@anuejn
Copy link

anuejn commented May 18, 2024

Describe the bug

I am trying to import a typescript file with ?url in my application.
I would like to get the file back with already stripped types (so as a js file). This is what happens in dev mode. In production mode, the file is left untouched and I get the raw typescript source.

The documentation is not very clear about what should happen, but I would argue, that this missmatch is a bug.

Reproduction

https://stackblitz.com/edit/vitejs-vite-rdougd?file=main.js,test.ts&terminal=dev

Steps to reproduce

  1. Run npm dev to get the typescript compiled to js.
  2. Run npm build && npm preview to get the typescript in its raw form
  3. Observe, that there is a missmatch

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^5.2.11 => 5.2.11

Used Package Manager

npm

Logs

No response

Validations

Copy link

stackblitz bot commented May 18, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red
Copy link
Member

Duplicate of #6757

@sapphi-red sapphi-red marked this as a duplicate of #6757 May 19, 2024
@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels May 19, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants