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

Add "jsx": "preserve" in jsconfig.json for vue3 javascript project #7113

Open
Gu-Miao opened this issue Apr 22, 2022 · 8 comments
Open

Add "jsx": "preserve" in jsconfig.json for vue3 javascript project #7113

Gu-Miao opened this issue Apr 22, 2022 · 8 comments

Comments

@Gu-Miao
Copy link

Gu-Miao commented Apr 22, 2022

What problem does this feature solve?

I use vscode and volar, when I create a new vue project, I find a warning from <template> tag by valor:

TypeScript intellisense is disabled on template, you can config `"jsx": "preserve"` in tsconfig or jsconfig to enable it, or config `vueCompilerOptions.experimentalDisableTemplateSupport` to disable this prompt.

If you do nothing with it or just set vueCompilerOptions.experimentalDisableTemplateSupport in jsconfig.json, you will find that your intelligent completion won't work anymore in template part. So I add "jsx": "preserve", and everything is fun again.

What does the proposed API look like?

Add "jsx": "preserve" to jsconfig.json by defualt when user create a vue3 javascript project.

@Naveenkumar153
Copy link

Naveenkumar153 commented May 2, 2022

using this code add your jsconfig.json file. this code solve my problem

"vueCompilerOptions": {
"experimentalDisableTemplateSupport": true,
"jsx": "preserve"
}

@Gu-Miao
Copy link
Author

Gu-Miao commented May 5, 2022

@Naveenkumar153 Yes, I know. That's the reason why I suggested we should add this option in template by default if when creating a vue3 project.

@egdavid
Copy link

egdavid commented May 8, 2022

For TypeScript projects, adding:

"vueCompilerOptions": {
    "experimentalDisableTemplateSupport": true
}

in tsconfig.json solves the problem.

@AntoineGGG
Copy link

I only add line below to my compilerOptions part in tsconfig.json to solve the problem, but yes as the author said, it'll be nice to implement it directly:

"jsx":"preserve"

@QiQiBiBi
Copy link

Agree.

I only add line below to my compilerOptions part in tsconfig.json to solve the problem, but yes as the author said, it'll be nice to implement it directly:

"jsx":"preserve"

@AaronBeaudoin
Copy link

This issue is important because otherwise the Vue 3 project arrives "incomplete" for VS Code users (which I would suspect is the majority) and requires additional configuration to get up and running properly.

It seems like it should be a relatively small change to implement.

@JayCph
Copy link

JayCph commented Sep 18, 2022

But what does the setting actually do other, what's the technical explanation behind it?

@AaronBeaudoin
Copy link

All I know is that it enables type checking in SFC templates. See vuejs/language-tools#1153.

For more details ask the author johnsoncodehk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants