nuxt / bridge

🌉 Experience Nuxt 3 features on existing Nuxt 2 projects
MIT License
268 stars 28 forks source link

Default nuxt config missing `analyzeDir` value #1032

Open Migushthe2nd opened 6 months ago

Migushthe2nd commented 6 months ago

Environment

Reproduction

Should be self-explanatory

Describe the bug

Running nuxi analyze results in

ERROR  The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

  at Object.rm (node:internal/fs/promises:722:38)
  at clearDir (node_modules/nuxi/dist/shared/nuxi.976cd438.mjs:11:20)
  at Object.run (node_modules/nuxi/dist/chunks/analyze.mjs:93:11)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7) 

The path here is the analyzeDir property in the nuxt config. This property does not seem to be assigned a default value ("/<rootDir>/.nuxt/analyze" as described in the nuxt docs), nor be resolved for example in the nitro config creation. buildDir is resolved in this case:

https://github.com/nuxt/bridge/blob/1fa3dce0df0c3122275a7d914ba7404b5fd01241/packages/bridge/src/nitro.ts#L67-L69

Additional context

Nitro enabled, Vite disabled.

When manually providing a value, nuxi analyze runs generates an html report.

    analyzeDir: "./.nuxt/analyze",

However, this default path seems to be conflicting with the 'Starting stats server' step.

Logs

No response

github-actions[bot] commented 6 months ago

Would you be able to provide a reproduction? 🙏

More info ### Why do I need to provide a reproduction? Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making. ### What will happen? If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect. If `needs reproduction` labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it. ### How can I create a reproduction? We have a couple of templates for starting with a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v2-bridge 👉 https://codesandbox.io/p/github/nuxt/starter/v2-bridge-codesandbox A public GitHub repository is also perfect. 👌 Please ensure that the reproduction is as **minimal** as possible. See more details [in our guide](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction). You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve)