vuejs / vetur

Vue tooling for VS Code.
https://vuejs.github.io/vetur/
MIT License
5.74k stars 593 forks source link

Vetur jsx broke down #3011

Open ariran5 opened 3 years ago

ariran5 commented 3 years ago

Info

Problem

2 errors, 1) Today, 17.06.2021, jsx says we want className attrs instead class. Few days ago all be normal

Снимок экрана 2021-06-17 в 23 06 13

vetur want react jsx

2) Slots in jsx is not a function, and async components too, for example

Снимок экрана 2021-06-17 в 23 11 01 Снимок экрана 2021-06-17 в 23 11 23 Снимок экрана 2021-06-17 в 23 06 39

Reproducible Case

use this code in any vue file with tsx language

<script lang="tsx">
import {
  defineComponent,
  PropType,
  resolveDynamicComponent,
  defineAsyncComponent,
} from 'vue';

export default defineComponent({
  props: {
    iconName: {
      type: String,
      required: true,
    },
  },
  components: {
    IconServer: defineAsyncComponent(
      () => import('../../vue-icons/server.vue')
    ),
    IconSettings: defineAsyncComponent(
      () => import('../../vue-icons/settings.vue')
    ),
  },
  render() {
    const IconElement = resolveDynamicComponent(this.iconName);

    return <div><IconElement /></div>
  },
});
</script>
ariran5 commented 3 years ago

I reinstall all packages and reinstall vscode with reboot my computer

ariran5 commented 3 years ago

first bug is phantom. I clone project in another folder and copy all new files from old folder, and it works without errors (classname)

but its only for first error.

Second error exists

ariran5 commented 3 years ago

I found, its after command with legacy deps

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: sberinfra@0.0.0
npm ERR! Found: vue@3.1.1
npm ERR! node_modules/vue
npm ERR!   vue@"^3.0.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vue@">= 2.5 < 3" from @vue/composition-api@1.0.0-rc.12
npm ERR! node_modules/@vue/composition-api
npm ERR!   peer @vue/composition-api@"^1.0.0-beta.16" from @vue/apollo-composable@4.0.0-alpha.12
npm ERR!   node_modules/@vue/apollo-composable
npm ERR!     @vue/apollo-composable@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/tuuds/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tuuds/.npm/_logs/2021-06-17T22_15_57_788Z-debug.log

npm i @vue/apollo-composable --legacy-peer-deps

yoyo930021 commented 3 years ago

If you try to use this options? https://www.typescriptlang.org/tsconfig#jsx

ariran5 commented 3 years ago

in vite by default used "preserve"

ariran5 commented 3 years ago

@apollo/client too broke vue jsx types

its visible after install package in project and restart vscode

ariran5 commented 3 years ago

Got it

// @apollo/client index.d.ts
export * from './core';
export * from './react';

@apollo/client exports react types, and if I import all library with react types -> types is broken I import @apollo/client/core without react types and it works normal

is there any way to fix this ?