Skip to content

Typescript error location is not displayed #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mobyrr opened this issue Apr 7, 2025 · 7 comments · Fixed by nuxt-contrib/vue-sfc-transformer#29 or nuxt-contrib/vue-sfc-transformer#36

Comments

@Mobyrr
Copy link

Mobyrr commented Apr 7, 2025

Describe the bug

When typescript parsing in template fail, the error location seems to be incorrectly displayed

[cause]: Transform failed with 1 error:
<stdin>:9:22: ERROR: Expected ")" but found ";"

the name of the file is <stdin> instead of the real name

Full error

> nuxt-module-build build

ℹ Building my-lib
ℹ Cleaning dist directory: ./dist

 ERROR  [vue-sfc-transform] Error parsing TypeScript expression in template

    at transformJsSnippets (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/vue-sfc-transformer/dist/shared/vue-sfc-transformer.Cv4FCBX6.mjs:390:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async transpileVueTemplate (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/vue-sfc-transformer/dist/shared/vue-sfc-transformer.Cv4FCBX6.mjs:309:24)
    at async templateLoader (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/vue-sfc-transformer/dist/mkdist.mjs:146:23) 
    at async /C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/vue-sfc-transformer/dist/mkdist.mjs:69:24
    at async Promise.all (index 1)
    at async /C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/vue-sfc-transformer/dist/mkdist.mjs:66:21
    at async loadFile (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected]_pdpc6a7g2cab5ggmqvwowom4ly/node_modules/mkdist/dist/shared/mkdist.CcWb7-AJ.mjs:319:23)
    at async mkdist (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected]_pdpc6a7g2cab5ggmqvwowom4ly/node_modules/mkdist/dist/shared/mkdist.CcWb7-AJ.mjs:678:21)
    at async mkdistBuild (/C:/projects/my-lib/module/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]_typescript@5._pkqujcdlb72xmdwfmgc7beimsy/node_modules/unbuild/dist/shared/unbuild.BQ_Ce1-K.mjs:1049:22)

  [cause]: Transform failed with 1 error:
<stdin>:9:22: ERROR: Expected ")" but found ";"

      at failureErrorWithLog (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1477:15)
      at node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:756:50
      at responseCallbacks.<computed> (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:623:9)
      at handleIncomingPacket (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:678:12)
      at Socket.readFromStdout (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:601:7)
      at Socket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:561:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
      at Readable.push (node:internal/streams/readable:392:5)
      at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
      at Socket.readFromStdout (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:601:7)
      at Socket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:561:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
      at Socket.readFromStdout (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:601:7)
      at Socket.readFromStdout (node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:601:7)
      at Socket.emit (node:events:518:28)
      at addChunk (node:internal/streams/readable:561:12)
      at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
      at Readable.push (node:internal/streams/readable:392:5)
      at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)



 ERROR  [vue-sfc-transform] Error parsing TypeScript expression in template
@AlansCodeLog
Copy link

I'm also getting this with 1.0.

@BayBreezy
Copy link

Any workaround found for this error?

@AlansCodeLog
Copy link

@BayBreezy I just downgraded for now.

@danielroe
Copy link
Member

this might have been fixed in https://github.com/nuxt-contrib/vue-sfc-transformer - could you provide a reproduction? 🙏

Copy link

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the needs-reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. Please provide a link to either :

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the needs-reproduction label that receives no meaningful activity (e.g. new comments with a reproduction link) will be closed by the maintainers and won't be looked at.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using a reaction on the topmost comment.

  • Please do not comment "I have the same issue" without repro steps
  • Please do not comment un-helpful messages such as "+1" on an issue, use reactions on the first comment instead.

I think my reproduction is good enough, why aren't you looking into it quicker?

We constantly monitor open issues for new comments.

However, sometimes we might miss one or two. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible.

I have a minimal reproduction to contribute to a closed issue.

If you have a minimal reproduction for a closed issue, please write a comment on the issue with a link to the reproduction.
We will review it and reopen the issue if it is sufficient.

Useful Resources

@Mobyrr
Copy link
Author

Mobyrr commented Apr 22, 2025

this is fixed with nuxt-contrib/vue-sfc-transformer#29
(I had the error because of a @blur="emit('blur'); isOpen = false" in one of my components, the sfc compiler didn't like the ;)

@Teages
Copy link

Teages commented Apr 22, 2025

this is fixed with nuxt-contrib/vue-sfc-transformer#29 (I had the error because of a @blur="emit('blur'); isOpen = false" in one of my components, the sfc compiler didn't like the ;)

nice catch, will fix it in nuxt-contrib/vue-sfc-transformer#36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants