question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nuxi generate - Unexpected token in composition API support files of nuxt-bridge

See original GitHub issue

Environment

Nuxt project info: 21:27:04


  • Operating System: Darwin
  • Node Version: v16.13.0
  • Nuxt Version: 2.16.0-27358576.777a4b7f
  • Package Manager: yarn@1.22.17
  • Builder: vite
  • User Config: bridge, ssr, target, head, css, plugins, components, buildModules, modules, io, axios, auth, build, router, elementUI, purgeCSS, typescript, i18n
  • Runtime Modules: @nuxtjs/axios@5.13.6, @nuxtjs/auth-next@5.0.0-1617968180.f699074, nuxt-socket-io@1.1.24, nuxt-element-ui@1.0.10, nuxt-i18n@6.28.1
  • Build Modules: @nuxtjs/stylelint-module@4.1.0, @nuxtjs/tailwindcss@4.2.1, @nuxt/postcss8@1.1.3, @nuxt/bridge@3.0.0-27566698.2b0045e

Reproduction

Describe the bug

I have migrated my Nuxt2 application to Nuxt-Bridge and if I run nuxi dev everything is working fine. But once I try to build the applications (static target) with nuxi generate, I get the following error:


ERROR in ./node_modules/@nuxt/bridge/dist/runtime/app.plugin.mjs 102:59
Module parse failed: Unexpected token (102:59)
File was processed with these loaders:
 * ./node_modules/unplugin/dist/webpack/loaders/transform.js
You may need an additional loader to handle the result of these loaders.
|     get (target, prop) {
|       if (prop[0] === '$') {
>         return target.nuxt2Context[prop] || target.vue2App?.[prop]
|       }
|       return Reflect.get(target, prop)
 @ ./.nuxt/index.js 48:0-76 375:25-55 381:19-49
 @ ./.nuxt/client.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/@nuxt/bridge/dist/runtime/capi.plugin.mjs ./.nuxt/client.js

ERROR in ./node_modules/@nuxt/bridge/dist/runtime/composables.mjs 27:27
Module parse failed: Unexpected token (27:27)
File was processed with these loaders:
 * ./node_modules/unplugin/dist/webpack/loaders/transform.js
You may need an additional loader to handle the result of these loaders.
|         return target.public;
|       }
>       return target[prop] ?? target.public[prop];
|     },
|     set(target, prop, value) {
 @ ./node_modules/@nuxt/bridge/dist/runtime/app.mjs 1:0-72 4:35-50 29:13-31
 @ ./node_modules/@nuxt/bridge/dist/runtime/index.mjs
 @ ./node_modules/@nuxt/bridge/dist/runtime/capi.plugin.mjs
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/@nuxt/bridge/dist/runtime/capi.plugin.mjs ./.nuxt/client.js

If I deactivate composition API support in the nuxt.config.js, the error disappears, but I am then unable to use the composition API (Which is one of the main reasons for me to migrate).

Can you give me any hint on what I might be doing wrong here?

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MartinX3commented, Jul 7, 2022

At the end it also tells me ✔ You can now deploy .output/public to any static hosting! But there is no .output/public Even no .output.

0reactions
danielroecommented, Jul 9, 2022

I cannot reproduce on the latest version of Nuxt Bridge with the zipfile linked by @MartinX3 above.

If you are still experiencing this, would you let me know and provide a minimal reproduction? 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build fails with SSR turned off · Issue #27 · nuxt/bridge - GitHub
Environment Operating System: Linux Node Version: v14.18.0 Nuxt Version: ... Unexpected token in composition API support files of nuxt-bridge #365.
Read more >
Nuxt Error: Syntax Unexpected token export after installation
This error can show up if you're importing an ES6 module which needs to be transpiled in order to load into the UI....
Read more >
How to fix Nuxt.js unexpected token export error - YouTube
Setting up Nuxt.js is a pretty straightforward process but I hit at least one snag. Here's how I got around an issue I...
Read more >
ES Modules · Nuxt Concepts
This guide helps explain what ES Modules are and how to make a Nuxt app (or upstream library) compatible with ESM. Background ·...
Read more >
Setup - Nuxt TypeScript
Nuxt TypeScript Support mainly comes through a Nuxt module, @nuxt/typescript-build, and its types @nuxt/types. Here are the guidelines to install ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found