Repository navigation
fix(analyze,dev): respect vite.server.allowedHosts in host checks - #1636
Conversation
commit: |
CLI benchmark
Full report
|
| Setting | Value |
|---|---|
| Baseline | ref:93315b9d1f20f71870d80b095017813789894466 (v4.0.1) |
| Head | local packages/nuxt-cli at baba73c (v4.0.1) |
| Node | v24.22.1 |
| OS | Linux 6.17.0 (kernel 6.17.0-1022-azure) |
| CPU | AMD EPYC 7763 64-Core Processor x 4 |
| Memory | 15.6 GB |
| Load average at start | 1.16, 0.33, 0.11 |
| Run started | 2026-10-26T18:35:51.268Z |
Cold CLI startup
Median of 15 interleaved runs per command, one warmup discarded.
| Command | baseline v4.0.1 median | head v4.0.1 median | Delta | baseline v4.0.1 min / p95 | head v4.0.1 min / p95 |
|---|---|---|---|---|---|
nuxt --version |
65 ms | 65 ms | -0.2% | 61 ms / 67 ms | 61 ms / 68 ms |
nuxt --version (first output byte) |
61 ms | 61 ms | -0.2% | 58 ms / 63 ms | 58 ms / 64 ms |
nuxt --help |
136 ms | 137 ms | +0.8% | 133 ms / 139 ms | 132 ms / 140 ms |
nuxt --help (first output byte) |
132 ms | 132 ms | +0.4% | 128 ms / 134 ms | 127 ms / 135 ms |
nuxt dev --help |
102 ms | 102 ms | -0.3% | 98 ms / 106 ms | 100 ms / 103 ms |
nuxt dev --help (first output byte) |
98 ms | 97 ms | -0.6% | 94 ms / 102 ms | 95 ms / 99 ms |
nuxt <unknown-command> (no-op) |
145 ms | 147 ms | +0.8% | 142 ms / 149 ms | 143 ms / 150 ms |
nuxt <unknown-command> (no-op) (first output byte) |
140 ms | 141 ms | +0.8% | 137 ms / 143 ms | 138 ms / 145 ms |
Module load cost
Counted with a module.registerHooks load hook, compile cache disabled. Counts every JS module actually evaluated on that code path (native addons excluded). Built-ins loaded after bootstrap are counted separately, including the internal modules they load.
| Command | baseline v4.0.1 modules | head v4.0.1 modules | Delta | baseline v4.0.1 source bytes | head v4.0.1 source bytes | Delta | baseline v4.0.1 built-ins | head v4.0.1 built-ins | Delta |
|---|---|---|---|---|---|---|---|---|---|
nuxt --version |
35 | 35 | 0.0% | 298.0 kB | 298.0 kB | 0.0% | 29 | 29 | 0.0% |
nuxt --help |
135 | 135 | 0.0% | 852.4 kB | 853.2 kB | +0.1% | 90 | 90 | 0.0% |
nuxt dev --help |
64 | 64 | 0.0% | 458.1 kB | 458.1 kB | 0.0% | 90 | 90 | 0.0% |
Install footprint and published tarball
Each version installed on its own into an empty project with nothing but @nuxt/cli as a dependency, so the tree is exactly the CLI and its transitive dependencies. npm cache is warm and the registry is only consulted for metadata, so install wall time is indicative, not a network benchmark.
| Metric | baseline v4.0.1 | head v4.0.1 | Delta |
|---|---|---|---|
Direct dependencies of @nuxt/cli |
23 | 23 | 0.0% |
| Packages in the installed tree (unique name@version) | 39 | 39 | 0.0% |
| Unique package names | 39 | 39 | 0.0% |
| Package directories on disk (cross-check) | 32 | 32 | 0.0% |
Installed node_modules on disk |
2.47 MB | 2.47 MB | +0.1% |
| Installed files | 436 | 436 | 0.0% |
| Install wall time (warm npm cache, median of 3) | 1.25 s | 1.25 s | +0.4% |
| Published tarball (packed) | 242.3 kB | 242.8 kB | +0.2% |
| Published tarball (unpacked) | 786.7 kB | 788.5 kB | +0.2% |
| Files in tarball | 101 | 101 | 0.0% |
Interleaved runs on a shared runner: trust the deltas, not the absolute timings. The dev, restart and build suites run locally via pnpm bench:cli.
|
No actionable comments were generated in the recent review.
|
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1636 +/- ##
=======================================
Coverage ? 84.31%
=======================================
Files ? 181
Lines ? 11655
Branches ? 3339
=======================================
Hits ? 9827
Misses ? 1540
Partials ? 288 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vite.server.allowedHosts in the host checkvite.server.allowedHosts in host checks
🔗 Linked issue
resolves #1620
📚 Description
The
Hostcheck on the CLI's own endpoints (/__nuxt_dev__/*, the loading page and the load-failure page) only knew the--hostvalue and the listener URLs. A project that setsvite.server.allowedHostsstill got a 403 from these endpoints, so the error overlay failed without a message on a hosts-file alias.Now the check also reads
vite.server.allowedHostsfrom the loadednuxt.config:.example.comallowsexample.comand all its subdomains.trueturns off only theHostcheck on these endpoints. It does not change CORS or anything else that--publicdoes.vite.server.allowedHostsare not read back as project entries.vite.server.allowedHostsinnuxt.config.Before the config loads (the first loading screen), the check is the same as before.
Known limit: when a project entry is the same as a hostname that the CLI added for the listener of the previous run, that entry gets a 403 on the first load. It works after the next reload. This fails toward the safe side (a 403), never toward an extra allow.
The analysis and the direction come from @Togetic in #1620.