ReferenceError in template literal
replygirl opened this issue · comments
replygirl commented
Found something
<script setup lang="ts">
const _foo = autoImportedFn()
const foo = `foo-${_foo}` // works
const bar = `bar-${autoImportedFn()}` // ReferenceError
</script>
I can see why it happens, but in case you didn't notice before
Vitesse reproduction
pnpm i nanoid
// /vite.config.ts
...
export default defineConfig({
...
plugins: [
...
AutoImport({
imports: [
...
{
nanoid: ['nanoid'],
},
],
}),
...
],
...
})
// /src/components/Footer.vue
<script setup lang="ts">
...
const _foo = nanoid()
const foo = `foo-${_foo}`
const bar = `bar-${nanoid()}`
</script>
<template>
<span>{{ foo }}, {{ bar }}</span>
</template>
replygirl commented