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
In Nuxt 3, custom queries are added to id when importing files under pages directory, such as /pages/index.vue?vue&type=script&lang.jsx¯o=true (in this case, macro=true)
In this case, vue jsx plugin does not acknowledge the context and throws an error.
ERROR Failed to parse sourcefor import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
WARN [SSR] Error transforming /pagess/index.vue?vue&type=script&setup=true&lang.jsx¯o=true: Failed to parse sourcefor import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
at formatError (node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38663:46)
at TransformContext.error (node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38659:19)
at TransformContext.transform (node_modules/vite/dist/node/chunks/dep-59dc6e00.js:56777:22)
at async Object.transform (node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38900:30)
at async doTransform (node_modules/vite/dist/node/chunks/dep-59dc6e00.js:55857:29)
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
IIUC extension needs to be at the end of id. So /pages/index.vue?vue&type=script&lang.jsx¯o=true needs to be /pages/index.vue?vue&type=script¯o=true&lang.jsx.
Probably no. Even if vue-jsx plugin accepted it, plugins which assume .jsx to be at the end (or at the end after removing query) will exist and they will not work.
But I'm not certain about this.
But this isn't commonly used yet, and it would break the ecosystem otherwise. I agree though that a behaviour like this isn't great at a glance, but I'd imagine a migration over to meta.vite.lang and then dropping checking extensions in Vite 4 would be the ideal path forward.
(I haven't considered other consequence of dropping the extensions check yet)
Describe the bug
In Nuxt 3, custom queries are added to id when importing files under pages directory, such as
/pages/index.vue?vue&type=script&lang.jsx¯o=true
(in this case,macro=true
)In this case, vue jsx plugin does not acknowledge the context and throws an error.
More info: nuxt/nuxt#13435
Probably related to PR vitejs/vite#7121
Reproduction
https://stackblitz.com/edit/vitejs-vite-uo2vwz
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: