Bug: nested quotes
leo-buneev opened this issue · 0 comments
leo-buneev commented
Hi! Great library.
I've encountered an issue with detecting usage of autoimported variables. If there's nested quotes (some quotes inside template literal), autoimported vars won't be detected and autoimport won't happen. Consider following example (assuming tc
should be autoimported):
// Leave one line below uncommented
// const str = `${tc.log1()}`; // works
const str = `'${tc.log1()}'`; // doesnt work
// const str = `"${tc.log1()}"`; // doesnt work
// const str = `${`test${tc.log1()}`}`; // doesnt work
document.querySelector('#app').innerHTML = `
<h1>Hello Vite! ${str}</h1>
`;
Full repro: https://stackblitz.com/edit/vite-hmbiei?file=main.js (it will crash when any line with "doesnt work" is uncommented)