使用 @vitejs/plugin-vue-jsx 会报错
w3cways opened this issue · 2 comments
w3cways commented
`import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
plugins: [
vue(),
vueJsx({
babelPlugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],//不加这个会报错
],
}),
]
`
tsx文件中,使用@component 没有问题,加了 @prop 就报错
`
import { Component, Prop, Vue, Emit, Watch } from 'vue-facing-decorator'
@component({})
export default class Login extends Vue {
@prop() test!: Boolean //加上这个会报错
render() {
return (
test
)
}
}
`
报错内容如下
[plugin:vite:vue-jsx] unknown file: Definitely assigned fields cannot be initialized here, but only in the constructor
ruojianll commented
还是写到ts文件里吧,然后import
pecasha commented
请问这个问题有解决了吗