Default nuxt config missing `analyzeDir` value
Environment
- Operating System: Windows_NT
- Node Version: v18.19.0
- Nuxt Version: 2.17.2-28284499.5674f49
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: webpack
- User Config: -
- Runtime Modules: -
- Build Modules: -
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
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.
You might also find these other articles interesting and/or helpful:
@danielroe @wattanx Is it assumed that the bundle analyzer works for Vite builds?
If I enable Nitro and Vite in the nuxt config, I need to add the 'analyzeDir' variable, otherwise the build won't start.
Also, if the config includes 'target: 'static'', the build will fail and will be compiled through webpack.
https://github.com/nuxt/bridge/blob/b8bd3463bd9caa12c26b8ff2d53c28edd37241ed/packages/bridge/src/nitro.ts#L23
There is no content when the server with statistics starts up
Is a repository with reproduction needed? I just took a new project and added nuxt bridge to it and tried to call nuxi analyze