wheatjs / vite-plugin-vue-type-imports

Import types in Vue SFC for defineProps
223 stars 17 forks source link

Error: Dynamic require of "path" is not supported #25

Closed yzh990918 closed 2 years ago

yzh990918 commented 2 years ago
image
yzh990918 commented 2 years ago
image
yzh990918 commented 2 years ago
image
Zolyn commented 2 years ago

Can you give a reproduction repo?

misogihagi commented 2 years ago

Hi I saw the same issue. here is my repo

easy two step can reproduce.

  1. type commands npm create vite@latest

Ok to proceed? (y) y ✔ Project name: … vite-project ✔ Select a framework: › vue ✔ Select a variant: › vue-ts

cd vite-project/
npm install
npm i vite-plugin-vue-type-imports
  1. rewrite three files

src/components/props.ts export type props={ msg: string }

src/components/HelloWorld.vue

~~~~~~~~~~~~~~~~~
import type {props} from './props'
defineProps<props>()
~~~~~~~~~~~~~~~~~

vite.config.ts

import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import VueTypeImports from 'vite-plugin-vue-type-imports'

export default defineConfig({
  plugins: [
    Vue(), 
    VueTypeImports(),
  ],
})
Zolyn commented 2 years ago

@wheatjs Do you have any release plan? It may be related to the version of the bundler. (See https://github.com/wheatjs/vite-plugin-vue-type-imports/issues/24#issuecomment-1221217545)

wheatjs commented 2 years ago

@wheatjs Do you have any release plan? It may be related to the version of the bundler. (See #24 (comment))

Yes, we can do a release tomorrow

wheatjs commented 2 years ago

@Zolyn New version has been released https://github.com/wheatjs/vite-plugin-vue-type-imports/releases/tag/v0.2.1

Zolyn commented 2 years ago

It should be fixed in v0.2.1