nuxt-graphql-middleware icon indicating copy to clipboard operation
nuxt-graphql-middleware copied to clipboard

Strange bug

Open konstantin-karlovich-unbiased-co-uk opened this issue 2 months ago • 6 comments

I’ve got a strange error:

 ERROR  Nuxt Build Error: [vite:vue] Missing semicolon. (6:7)
at constructor (node_modules\@babel\parser\lib\index.js:367:19)
    at TypeScriptParserMixin.raise (node_modules\@babel\parser\lib\index.js:6630:19)
    at TypeScriptParserMixin.semicolon (node_modules\@babel\parser\lib\index.js:6926:10)
    at TypeScriptParserMixin.parseExpressionStatement (node_modules\@babel\parser\lib\index.js:13294:10)
    at TypeScriptParserMixin.parseExpressionStatement (node_modules\@babel\parser\lib\index.js:9616:26)
    at TypeScriptParserMixin.parseStatementContent (node_modules\@babel\parser\lib\index.js:12908:19)
    at TypeScriptParserMixin.parseStatementContent (node_modules\@babel\parser\lib\index.js:9532:18)
    at TypeScriptParserMixin.parseStatementLike (node_modules\@babel\parser\lib\index.js:12776:17)
    at TypeScriptParserMixin.parseModuleItem (node_modules\@babel\parser\lib\index.js:12753:17)
    at TypeScriptParserMixin.parseBlockOrModuleBlockBody (node_modules\@babel\parser\lib\index.js:13325:36)
    at TypeScriptParserMixin.parseBlockBody (node_modules\@babel\parser\lib\index.js:13318:10)
    at TypeScriptParserMixin.parseProgram (node_modules\@babel\parser\lib\index.js:12634:10)
    at TypeScriptParserMixin.parseTopLevel (node_modules\@babel\parser\lib\index.js:12624:25)
    at TypeScriptParserMixin.parse (node_modules\@babel\parser\lib\index.js:14501:10)
    at TypeScriptParserMixin.parse (node_modules\@babel\parser\lib\index.js:10149:18)
    at Object.parse (node_modules\@babel\parser\lib\index.js:14535:38)
    at parseFile (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22747:21)
    at fileToScope (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22738:16)
    at node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22519:17
    at Array.map (<anonymous>)
    at resolveGlobalScope (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22518:40)
    at innerResolveTypeReference (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22464:30)
    at resolveTypeReference (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22446:20)
    at innerResolveTypeElements (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:22031:24)
    at resolveTypeElements (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:21971:20)
    at resolveRuntimePropsFromType (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:23699:20)
    at extractRuntimeProps (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:23675:17)
    at genRuntimeProps (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:23663:18)
    at Object.compileScript (node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:24677:21)
    at resolveScript (/D:/projects/uk-consumer-website/node_modules/@vitejs/plugin-vue/dist/index.js:309:36)
    at genScriptCode (/D:/projects/uk-consumer-website/node_modules/@vitejs/plugin-vue/dist/index.js:1755:17)
    at transformMain (/D:/projects/uk-consumer-website/node_modules/@vitejs/plugin-vue/dist/index.js:1641:53)
    at Object.handler (/D:/projects/uk-consumer-website/node_modules/@vitejs/plugin-vue/dist/index.js:2045:27)
    at Object.handler (/D:/projects/uk-consumer-website/node_modules/vite/dist/node/chunks/dep-B0GuR2De.js:33959:13)
    at /D:/projects/uk-consumer-website/node_modules/rollup/dist/es/shared/node-entry.js:22426:40

It appeared after I updated Nuxt to the latest version. What’s more, it appears even when you simply add the module without configuring it.

@dulnan

I discovered that the problem concerns these files https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/client-options.ts https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/config.ts https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/graphql.config.ts https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/helpers.ts https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/operation-variables.ts https://github.com/dulnan/nuxt-graphql-middleware/blob/main/src/build/templates/definitions/server-options.ts

@dulnan ?

@konstantin-karlovich-unbiased-co-uk Sorry for not getting back to you earlier, I was a bit too busy with work the past two weeks.

I will take a look in the playground and update to the latest Nuxt version; so far I haven't come across this issue on any of my projects that use this module.

dulnan avatar Oct 27 '25 13:10 dulnan

I set up a new Nuxt project with version 4.2.0 and installed the latest version of the module without any errors. If possible, could you provide some additional context such as your package.json, Node version, etc.?

dulnan avatar Oct 27 '25 13:10 dulnan

@dulnan I'm not sure if the error is in your module. But when I added this particular module, the build threw me the error above. The problem was solved when I removed the typescript utilities (Pick, Omit, etc.) from defineProps in my components. It seems strange, but if you don't connect your module, everything works