Skip to content

Cannot find module '@babel/types' or its corresponding type declarations #5625

Closed
@qmhc

Description

@qmhc

Version

3.2.31

Reproduction link

reproduction

Steps to reproduce

This project is created by create-vite:

pnpm create vite project -- --template vue-ts

Update dependencies to the latest version then change src/main.ts to src/index.ts:

{
  "devDependencies": {
    "@vitejs/plugin-vue": "^2.2.4",
    "typescript": "^4.6.3",
    "vite": "^2.8.6",
    "vue-tsc": "^0.33.7"
  }
}
import App from './App.vue'

export default App

Change vite.config.ts to build lib:

import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    lib: {
      entry: resolve(__dirname, 'src/index.ts'),
      name: 'Test',
      formats: ['es'],
      fileName: 'test'
    },
    rollupOptions: {
      external: ['vue']
    }
  },
  plugins: [
    vue()
  ]
})

Install project and run:

pnpm run build

What is expected?

Build successful.

What is actually happening?

image

Will take some errors and build fail.

If this is just a problem of vue-tsc (volar), please help migrate this issue, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions