Property 'setup' does not exist on type '{}'
Rasool-deldar opened this issue · comments
Hello, good morning, I'm sorry, I installed your package for Laravel-Mix according to the instructions, but unfortunately, the typing script gives the following error
: Property 'setup' does not exist on type '{}'.
node -v 16. *
vue 2.6.14
typescript: 4.5.5
@ vue / composition-api -v 1.4.6
@ vue / runtime-dom -v 3.2.31
unplugin-vue2-script-setup -v 0.9.3
// laravel-mix
mix.webpackConfig({
plugins: [
ScriptSetup({
}),
]});
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": false,
"noImplicitAny": false,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": [
"esnext",
"dom"
],
"types": [
"@types/node",
"unplugin-vue2-script-setup/types"
],
"baseUrl": ".",
"paths": {
"@/*": [
"resources/scripts/*"
],
}
},
"vueCompilerOptions": {
"experimentalCompatMode": 2
},
"include": [
"*.js",
"*.js",
".*.js",
"*.ts",
],
"exclude": [
"node_modules",
"vendor",
"public",
]
}
me too. if my ts-loader options transpileOnly is false
my tsconfig
"types": [
"unplugin-vue2-script-setup/types",
"unplugin-vue2-script-setup/ref-macros"
],
@Rasool-deldar try ts-loader options transpileOnly be true and use ForkTsCheckerWebpackPlugin to check ts in webpack config
{
loader: 'ts-loader',
options: {
transpileOnly: true,
}
}
plugins: [
new ForkTsCheckerWebpackPlugin(
{
typescript: {
extensions: {
vue: {
enabled: true,
compiler: '@vue/compiler-sfc'
}
},
diagnosticOptions: {
semantic: true,
syntactic: false
}
}
}
)
]
@Rasool-deldar try ts-loader options transpileOnly be true and use ForkTsCheckerWebpackPlugin to check ts in webpack config
{ loader: 'ts-loader', options: { transpileOnly: true, } }
plugins: [ new ForkTsCheckerWebpackPlugin( { typescript: { extensions: { vue: { enabled: true, compiler: '@vue/compiler-sfc' } }, diagnosticOptions: { semantic: true, syntactic: false } } } ) ]
Thank you for your help.