fix(compiler-sfc): should also expose regular script block bindings when <script setup> is used

close #4369
This commit is contained in:
Evan You
2021-08-17 15:52:48 -04:00
parent e22d7cdb08
commit 872b3f7ec5
3 changed files with 36 additions and 4 deletions

View File

@@ -827,6 +827,13 @@ export function compileScript(
)
}
}
} else if (
(node.type === 'VariableDeclaration' ||
node.type === 'FunctionDeclaration' ||
node.type === 'ClassDeclaration') &&
!node.declare
) {
walkDeclaration(node, setupBindings, userImportAlias)
}
}
}