-
Notifications
You must be signed in to change notification settings - Fork 5
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
TypeError: Preview is not a function #16
Comments
I got the same error in the project geneareted by yarn, in windows 10. Reproduction:
Then I see the terminal named volar-preview:3333
Actually the impoted plugin is import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import preview from "vite-plugin-vue-component-preview"
console.debug(preview)
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), preview()],
}) By replacing
|
I can't reproduce this problem with a new project create via |
|
@Take-Me1010 @Loongphy Thanks for the information, I have no idea for now, but the problem may come from: |
About the TypeError problem, How about changing configures like below?
{
"type": "module",
}
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
},
} The js files generated by |
works for me |
Please try v1.1.0 |
Re-opened as the relevant changes have been reverted as it broke Vue and Nuxt Preview, maybe have to build .mjs + .cjs together. |
vitejs/vite#8178 |
@johnsoncodehk I found this, maybe it will help you |
Project created by
pnpm create vite my-vue-app --template vue-ts
In
vite.config.ts
,Preview()
got errorTypeError: Preview is not a function
, usingPreview.default()
works fine but got typescript errorProperty 'default' does not exist on type '() => Plugin_2'.
The text was updated successfully, but these errors were encountered: