Задать вопрос
@dom12

Как решить проблему: import type TVue from «@vue/runtime-core»?

При запуске скрипта: tsc -b && vite build
Получаю ошибку:
node_modules/.pnpm/@yandex+ymaps3-types@1.0.16_6a00141768c98435da9094fd817fa55a/node_modules/@yandex/ymaps3-types/modules/vuefy/index.d.ts:3:23 - error TS2307: Cannot find module '@vue/runtime-core' or its corresponding type declarations.
3 import type TVue from "@vue/runtime-core";

Подскажите как решить данную проблему?

tsconfig.json
{
  "compilerOptions": {
    "target": "ESNext",
    "jsx": "react",
    "lib": ["ESNext","DOM","DOM.Iterable"],
    "module": "ESNext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "types": [
      "vite/client",
      "@yandex/ymaps3-types"
    ],
    "allowJs": false,
    "strict": true,
    "noEmit": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "skipLibCheck": false, 
    "allowImportingTsExtensions": true,
    "moduleDetection": "force",
    "removeComments": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitThis": false,
    "noUncheckedSideEffectImports": true
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.d.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}

vite.config.js
import { defineConfig } from 'vite';
import { resolve } from 'path';
import react from '@vitejs/plugin-react';
import autoprefixer from 'autoprefixer';
import eslint from 'vite-plugin-eslint2';

export default defineConfig({
    root: resolve(__dirname, 'src'),
    plugins: [
        react(),
        eslint()
    ],
    css: {
        postcss: {
            plugins: [
                autoprefixer({})
            ]
        },
        preprocessorOptions: {
            scss: {
                api: 'modern-compiler'
            }
        }
    },
    optimizeDeps: {
        esbuildOptions: {
            target: 'esnext'
        }
    },
    build: {
        target: 'esnext',
        minify: true,
        emptyOutDir: true,
        outDir: '../public_html',
        rollupOptions: {
            input: {
                main: resolve(__dirname, 'src/index.html')
            },
            output: {
                inlineDynamicImports: true,
                entryFileNames: `script.js`,
                assetFileNames: ({ names }) => {
                    if (/\.css$/.test(names[0] ?? '')) {
                        return 'style.min.css';
                    }else{
                        return 'assets/[name].[ext]'
                    }
                }
            }
        }
    }
});
  • Вопрос задан
  • 24 просмотра
Подписаться 1 Простой Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы