Skip to content
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

Nuxt-bridge #480

Merged
merged 103 commits into from
Jan 8, 2022
Merged

Nuxt-bridge #480

merged 103 commits into from
Jan 8, 2022

Conversation

tobiasdiez
Copy link
Member

@tobiasdiez tobiasdiez commented Sep 16, 2021

Todo:

For later: This is now #770

@tobiasdiez tobiasdiez marked this pull request as draft September 16, 2021 09:55
@tobiasdiez
Copy link
Member Author

tobiasdiez commented Oct 12, 2021

@pi0 I've encountered a few other issues now:

  • As suggested in https://github.com/nuxt/framework/blob/2a0afbd09296cd65d30c5ef5a5324d64149bc3fe/packages/bridge/src/runtime/capi.legacy.mjs#L249, I tried to use useRouter from @nuxt/bridge. However, this doesn't seem to work as useRouter etc are not exported by the bridge module. Using #app seems to work (at least there is not compilation problem reported) but I then loose typescript support which cannot find the module #app.
  • How does one activate vite support? The documentation says it is supported.
  • Now nuxt dev seems to work, but at the end it displays an "Invalid or unexpected token" issue and in the browser only the nuxt loading screen is displayed (for existing and non-existing routes).
    i Preparing project for development                                                                                                                                                                                                                       
    i Initial build may take a while                                                                                                                                                                                                                          
    i Discovered Components: .nuxt/components/readme.md                                                                                                                                                                                                       
    √ Builder initialized                                                                                                                                                                                                                                     
    √ Nuxt files generated                                                                                                                                                                                                                                    
    √ Client
      Compiled successfully in 20.39s
    
    i Waiting for file changes 
    i Memory usage: 832 MB (RSS: 937 MB)                                                                                                                                                                                                                      
    i Listening on: http://localhost:3000/                                                                                                                                                                                                                    
    √ Nitro built in 551 ms                                                                                                                                                                                                                                   
     WARN  [worker] Invalid or unexpected token                                                                                                                                                                                                               
      at Loader.moduleStrategy (node:internal/modules/esm/translators:146:18)
      at async link (node:internal/modules/esm/module_job:67:21)
    
    This might be related to https://github.com/nuxt/framework/discussions/912.
  • nuxt build ends with the following rollup error
    i Nitro preset is browser                                                                                                                                                                                                                                 
    i Cleaning up .output                                                                                                                                                                                                                                     
    start Generating public...                                                                                                                                                                                                                                
    √ Generated public .output/public                                                                                                                                                                                                                         
    start Building server...                                                                                                                                                                                                                                  
    
    ERROR  Rollup error: Could not load D:/Programming/JabRefOnline/.nuxt/dist/server/server.mjs (imported by node_modules\@nuxt\nitro\dist\runtime\app\render.mjs): ENOENT: no such file or directory, open 'D:\Programming\JabRefOnline\.nuxt\dist\server\server.mjs'
    
    (as can be seen also in the github check)
    This has been reported now as Build fails with SSR turned off nuxt/bridge#27.

I tried to search for these issues in the nuxt3 repo and docs but couldn't find anything. Let me know if I should create an new issue at the nuxt repo or if you prefer to discuss things here. Thanks for your help!

@pi0
Copy link

pi0 commented Oct 13, 2021

Hi @tobiasdiez sorry for late response.

  • For router, you can use useNuxtApp().legacyApp.$router
  • and #app types should be available. see update tsconfig. You need to use nuxi dev
  • For vite, you need to set { bridge: { vite: true } }
  • Invalid or unexpected token can happen for many reasons. Maybe you can check .nuxt/dist/server/server.mjs to spot the error
  • Thanks for linking SPA issue. Will check it

Anyway thanks for early testing bridge and helping us on leftover issues 💚

@tobiasdiez
Copy link
Member Author

tobiasdiez commented Oct 13, 2021

No worries @pi0. I do understand that you have a lot on your mind at the moment. That's why I'm all the more pleased about your answer.

With your help I was now able to migrate the project, more or less (at least nuxt dev starts now). There are a few issues remaining: nuxt/bridge#284 (for vite support), nuxt/bridge#27 (for ssr = true) and nuxt/bridge#258 and nuxt-modules/tailwindcss#390 (for the tailwind config viewer, which was the source of the invalid or unexpected token error above). Thanks for all the hard work you and the team put into the new version. This looks much smoother than what I would have expected from a early public beta!

@tobiasdiez tobiasdiez marked this pull request as ready for review January 8, 2022 16:33
@tobiasdiez tobiasdiez merged commit d00e1ab into main Jan 8, 2022
@tobiasdiez tobiasdiez deleted the nuxt-bridge branch January 8, 2022 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants