You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can I see, I dynamically import two .json files, which I might do in the real world to get data. When I run my project, I get the following error:
/App.vue:8
console.log(await __vite_ssr_import_0__.default((__vite_ssr_import_meta__.glob("./data/whatever/*.json")), `./data/whatever/${filename}.json`));
^
TypeError: __vite_ssr_import_meta__.glob is not a function
at getTestData (/App.vue:8:77)
The error can be avoided by either:
Removing the class="whatever" attribute.
Removing one of the dynamic imports.
The reason for this is because the cause of the issue is the stripLiteral function used internally by Vite. For a more detailed explanation, please read the README of the minimal reproduction repository.
The text was updated successfully, but these errors were encountered:
AaronBeaudoin
changed the title
Acorn trips up on this input, and the regex fallback does too
Vue SFC compilation breaking during SSR due to strip-literalFeb 2, 2023
AaronBeaudoin
changed the title
Vue SFC compilation breaking during SSR due to strip-literal
Vue SFC compilation breaking during SSR in Vite due to strip-literalFeb 2, 2023
Describe the bug
Suppose I have a Vite SSR project with a simple
App.vue
file like this:As you can I see, I dynamically import two
.json
files, which I might do in the real world to get data. When I run my project, I get the following error:The error can be avoided by either:
class="whatever"
attribute.The reason for this is because the cause of the issue is the
stripLiteral
function used internally by Vite. For a more detailed explanation, please read theREADME
of the minimal reproduction repository.Reproduction
https://github.com/AaronBeaudoin/vite-ssr-issue-vue-sfc-dynamic-import
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: