-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
@vitejs/plugin-vue will remove the code comment when <script lang="ts"> #7036
Comments
Not sure if this is due to your tsconfig but in your compiler options do you have the |
I don't have this option, It still doesnt work even if I set it to false. This is my
|
TS in Vue is being processed via esbuild. esbuild drops comments by default (evanw/esbuild#221) and there isn't a way to configure it, so I don't think there's a way around it, other than changing your strategy. It seems like you're doing something like https://github.com/bluwy/vite-plugin-iso-import though. Perhaps that might help. |
Its helpful for me, Thanks, Stared 👍 |
I don't think this will be fixed by esbuild soon, and it may as well be intended behaviour for them, as custom comments usually shouldn't affect the bundling output (except special pure comments etc). So I'll close this for now. |
Describe the bug
my vite plugin:
my vite config:
but I found if the *.vue' file's <script> with lang='ts', the comment in code will be remove:
btw, the <script> without lang='ts', will keep the comment
I try to trace the source code
Its like doing something in
options.compiler.rewriteDefault
How should I keep the comment? Thanks all
Reproduction
https://stackblitz.com/edit/vitejs-vite-myfppw?file=vite.config.ts&terminal=dev
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: