Skip to content

Nuxt dev mode support - #5551

Merged
jamesdaniels merged 48 commits into
firebase:masterfrom
monogramdesign:nuxt/dev-mode
Apr 12, 2023
Merged

jamesdaniels merged 48 commits into
firebase:masterfrom
monogramdesign:nuxt/dev-mode

Conversation

@leoortizz

Copy link
Copy Markdown
Member

Description

Scenarios Tested

Sample Commands

Comment thread tsconfig.json Resolved
@DevJoghurt

Copy link
Copy Markdown

I have tested this pull request with my more complex nuxt3 apps and have the following comments.
The current implementation does not support monorepo setup. For this you could change the call a little bit and see where the app is located and then just let the nuxt cli do everything else:

  // get root dir of nuxt app
  const cmdParams = ['dev'];
  if(dir.split(process.cwd()).length > 1){
    cmdParams.push(dir.split(process.cwd() + '/')[1])
  }
  const host = new Promise<string>((resolve) => {
    const serve = spawn(CLI_COMMAND, cmdParams);
  ...

I have also noticed many URL errors in my more complex apps, the following fix seems to be the way forward:

 // workaround for non-standard Nuxt URLs
 if (queryString.includes("vue&")) {
   fetchURL = fetchURL.replace(/\=$/, "").replace(/\=&/, "&");
 }

However, I still have massive problems for example with tailwind (@nuxtjs/tailwindcss) or with the new dev tool (@nuxt/devtools). I think the problem will also occur with many other use cases, but i have not yet been able to look deeper to find out exactly where the problem lies.

@leoortizz

Copy link
Copy Markdown
Member Author

I have tested this pull request with my more complex nuxt3 apps and have the following comments. The current implementation does not support monorepo setup. For this you could change the call a little bit and see where the app is located and then just let the nuxt cli do everything else:

  // get root dir of nuxt app
  const cmdParams = ['dev'];
  if(dir.split(process.cwd()).length > 1){
    cmdParams.push(dir.split(process.cwd() + '/')[1])
  }
  const host = new Promise<string>((resolve) => {
    const serve = spawn(CLI_COMMAND, cmdParams);
  ...

I have also noticed many URL errors in my more complex apps, the following fix seems to be the way forward:

 // workaround for non-standard Nuxt URLs
 if (queryString.includes("vue&")) {
   fetchURL = fetchURL.replace(/\=$/, "").replace(/\=&/, "&");
 }

However, I still have massive problems for example with tailwind (@nuxtjs/tailwindcss) or with the new dev tool (@nuxt/devtools). I think the problem will also occur with many other use cases, but i have not yet been able to look deeper to find out exactly where the problem lies.

The current implementation does not support monorepo setup

Thanks for the great feedback! I'll investigate the problems you mentioned.

@leoortizz

Copy link
Copy Markdown
Member Author

I have tested this pull request with my more complex nuxt3 apps and have the following comments. The current implementation does not support monorepo setup. For this you could change the call a little bit and see where the app is located and then just let the nuxt cli do everything else:

  // get root dir of nuxt app
  const cmdParams = ['dev'];
  if(dir.split(process.cwd()).length > 1){
    cmdParams.push(dir.split(process.cwd() + '/')[1])
  }
  const host = new Promise<string>((resolve) => {
    const serve = spawn(CLI_COMMAND, cmdParams);
  ...

I tried a monorepo with Nuxt3 projects and also had issues running it. Turns out the errors were also happening by running the Nuxt project directly, without Firebase. I found the fixes for those errors here: nuxt/nuxt#14146 (comment)

Does this fixes your issues with monorepos? If not can you share more details about the errors you had and ways to reproduce it?

I have also noticed many URL errors in my more complex apps, the following fix seems to be the way forward:

 // workaround for non-standard Nuxt URLs
 if (queryString.includes("vue&")) {
   fetchURL = fetchURL.replace(/\=$/, "").replace(/\=&/, "&");
 }

However, I still have massive problems for example with tailwind (@nuxtjs/tailwindcss) or with the new dev tool (@nuxt/devtools). I think the problem will also occur with many other use cases, but i have not yet been able to look deeper to find out exactly where the problem lies.

I was able to reproduce the errors with @nuxtjs/tailwindcss and the small change I pushed fixed that. Can you try and see if your errors are gone? If not can you share the errors you get?

For @nuxt/devtools the problem seems to be related to our proxy which doesn't support WebSockets. The WebSockets support is being implemented.

@DevJoghurt

Copy link
Copy Markdown

@leoortizz
Yes, I can confirm that even my larger projects are now working as expected.

Regarding the monorepo setup, I currently only tested yarn or npm with workspaces, there the error seems to be different.
I was able to fix the issue by not explicitly setting the CLI_COMMAND to the path of node_modules, but simply using nuxt dev directly. Is there a special reason for taking the path ("node_modules/.bin/nuxt")?

@codecov-commenter

codecov-commenter commented Mar 24, 2023 •

Copy link
Copy Markdown

Codecov Report

Patch coverage: 80.00% and project coverage change: +0.04 🎉

Comparison is base (11f7108) 55.68% compared to head (b425f2c) 55.73%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5551      +/-   ##
==========================================
+ Coverage   55.68%   55.73%   +0.04%     
==========================================
  Files         322      322              
  Lines       21812    21830      +18     
  Branches     4453     4454       +1     
==========================================
+ Hits        12147    12166      +19     
+ Misses       8597     8596       -1     
  Partials     1068     1068              
Impacted Files Coverage Δ
src/frameworks/nuxt2/index.ts 28.84% <60.00%> (+1.06%) ⬆️
src/frameworks/nuxt/utils.ts 88.88% <75.00%> (-11.12%) ⬇️
src/frameworks/nuxt/index.ts 62.26% <84.61%> (+16.31%) ⬆️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@leoortizz
leoortizz marked this pull request as ready for review March 27, 2023 16:26
@leoortizz
leoortizz requested a review from TheIronDev March 27, 2023 16:26
Comment thread src/frameworks/nuxt/index.ts Resolved
Comment thread src/frameworks/nuxt/index.ts Resolved
@leoortizz
leoortizz requested a review from jamesdaniels March 31, 2023 18:44
@leoortizz
leoortizz requested a review from TheIronDev April 10, 2023 20:04
Comment thread src/test/frameworks/nuxt/helpers.ts Resolved

@TheIronDev TheIronDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. I'm Awaiting a James Approval before merging this in.

@jamesdaniels
jamesdaniels enabled auto-merge (squash) April 12, 2023 05:22

@jamesdaniels jamesdaniels left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nits, I dropped them in—otherwise let's go!

@jamesdaniels
jamesdaniels merged commit 8207170 into firebase:master Apr 12, 2023
ProfHercules pushed a commit to ProfHercules/firebase-tools that referenced this pull request May 5, 2023
Co-authored-by: Claudio F <[email protected]>
Co-authored-by: James Daniels <[email protected]>
tonyjhuang pushed a commit that referenced this pull request May 22, 2023
Co-authored-by: Claudio F <[email protected]>
Co-authored-by: James Daniels <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants