Make VuePress base, dest and sitemap hostname configurable#1663
Make VuePress base, dest and sitemap hostname configurable#1663
Conversation
Move hardcoded `base: '/'` and the implicit dist directory out of the VuePress config so the docs site can be deployed under a sub-path (e.g. `/docs/`) without editing the config file. - `docs/.vuepress/config.js` now reads `base`, `dest` and the sitemap `hostname` from (in precedence order) env vars `DOCS_BASE`, `DOCS_DEST`, `DOCS_HOSTNAME`, then `docs/.vuepress/build.config.js`, then existing built-in defaults. - New `docs/.vuepress/build.config.js` sets the production values (`base: '/docs/'`, `dest: 'docs/.vuepress/dist/docs'`). - `base` is normalized to start and end with `/`. - The sitemap plugin already prepends `base` to every URL and writes `sitemap.xml` to the configured `dest`, so no plugin change is needed.
| * DOCS_HOSTNAME — absolute origin used for the sitemap | ||
| */ | ||
| module.exports = { | ||
| base: '/docs/', |
There was a problem hiding this comment.
New default base breaks hardcoded favicon head paths
Medium Severity
Setting the default base to '/docs/' causes the existing head entries for favicons and the web manifest to break. VuePress 1.x does not auto-prepend base to href attributes in head config entries. The five favicon/manifest links still reference /favicon/... instead of /docs/favicon/..., so they will 404 when deployed under the new default sub-path.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1c77a8b. Configure here.
Performance comparison of head (67f6148) vs base (1852159) |
The Netlify build was failing with "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS" because Netlify dropped Node 16 support and newer Node versions reject that flag from the env-var allowlist. The publish directory also needed updating to match the new `dest: docs/.vuepress/dist/docs` from this PR. - netlify.toml: declarative build command, publish directory, and NODE_VERSION, replacing the stale UI-side settings. - .nvmrc: v16 -> v18 (Node 16 is EOL and unsupported by Netlify). Node 18 still accepts `--openssl-legacy-provider`, which the current vuepress/webpack toolchain needs.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 67f6148. Configure here.
| ['link', { rel: 'mask-icon', color: '#ffffff', href: '/favicon/safari-pinned-tab.svg' }], | ||
| ], | ||
| base: '/', | ||
| base: DOCS_BASE, |
There was a problem hiding this comment.
Non-root base breaks hardcoded head asset paths
High Severity
Changing base from '/' to DOCS_BASE (defaulting to '/docs/') breaks the head config entries which use hardcoded absolute paths like /favicon/apple-touch-icon.png. VuePress 1.x does not auto-prepend base to head tag attributes, so these will 404 in production since the actual assets are served under /docs/favicon/....
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 67f6148. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1663 +/- ##
===========================================
+ Coverage 96.77% 97.18% +0.41%
===========================================
Files 174 174
Lines 15086 15086
Branches 3223 3223
===========================================
+ Hits 14599 14662 +63
+ Misses 487 424 -63 🚀 New features to boost your workflow:
|
## Summary Follow-up to #1663. The Netlify deploy succeeded but `https://hyperformula-docs.netlify.app/docs/` returns 404. Root cause: with `base: '/docs/'`, VuePress emits assets and internal links under `/docs/...` and writes the build to `docs/.vuepress/dist/docs/`. Setting `publish = "docs/.vuepress/dist/docs"` made Netlify serve those files at `/`, so the page rendered but every internal `/docs/...` reference 404'd. The publish dir must be the **parent** of the base path so the on-disk `docs/` subdirectory becomes the URL `/docs/`. Change: `publish = "docs/.vuepress/dist"` in `netlify.toml`. ## Test plan - [ ] Netlify deploys successfully. - [ ] `https://hyperformula-docs.netlify.app/docs/` renders the docs home (no 404). - [ ] Sub-pages like `/docs/guide/demo.html` load with assets and CSS intact. - [ ] `/sitemap.xml` is reachable and entries point at `https://hyperformula.handsontable.com/docs/...`. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk configuration-only change that affects where Netlify serves built docs from; primary risk is misconfiguration leading to broken/404 docs paths. > > **Overview** > Fixes the Netlify deployment config by changing the `publish` directory from `docs/.vuepress/dist/docs` to `docs/.vuepress/dist`, ensuring the built `docs/` subdirectory is served at `/docs/` and internal asset/link paths resolve correctly. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit be5594b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Summary
base: '/'and the implicit dist output path out ofdocs/.vuepress/config.jsso the docs site can be deployed under a sub-path (e.g./docs/) without editing the config file.docs/.vuepress/build.config.jsas a single place to set production values (base: '/docs/',dest: 'docs/.vuepress/dist/docs', sitemaphostname).DOCS_BASE/DOCS_DEST/DOCS_HOSTNAME) →build.config.js→ existing built-in default.baseis normalized to start and end with/.vuepress-plugin-sitemapalready prependsbaseto every URL and writessitemap.xmlinto the configureddest.Test plan
npm run docs:buildcompletes successfully.docs/.vuepress/dist/docs/(notdocs/.vuepress/dist/).docs/.vuepress/dist/docs/index.htmlreferences assets under/docs/....docs/.vuepress/dist/docs/sitemap.xmlexists and every<loc>ishttps://hyperformula.handsontable.com/docs/....DOCS_BASE=/ DOCS_DEST=docs/.vuepress/dist npm run docs:buildreproduces the old layout.npm run docs:devstill serves locally.Note
Medium Risk
Medium risk because it changes docs build/deploy configuration (base path, output directory, sitemap hostname) and upgrades the expected Node version to 18, which could affect CI/hosting builds if environments aren’t aligned.
Overview
Makes the VuePress docs build configurable by introducing
docs/.vuepress/build.config.jsand allowingDOCS_BASE,DOCS_DEST, andDOCS_HOSTNAMEto overridebase, build outputdest, and sitemaphostname(withbasenormalized to include leading/trailing/).Updates deployment defaults to publish docs under
/docs/and output todocs/.vuepress/dist/docs, and addsnetlify.tomlplus a.nvmrcbump to Node 18 to align the build environment.Reviewed by Cursor Bugbot for commit 67f6148. Bugbot is set up for automated code reviews on this repo. Configure here.