VuePress 1.x Static Site Generator
VuePress 1.x is a Vue-powered static site generator designed primarily for technical documentation. It enables authors to write content in Markdown and embed Vue components directly within it, offering a flexible and interactive documentation experience. The current stable version is 1.9.10, released in August 2023. Key differentiators include its Vue component-based layout system, a powerful plugin API for extending functionality, and a theming system. Since version 1.9.0, it features full TypeScript support for configuration files, and since 1.9.2, for plugins and themes, enhancing developer experience with type inference. While 1.x receives occasional bug fixes, it is officially in maintenance mode, with the core team's focus shifted to VuePress 2.x (which uses Vue 3 and ESM) and the even lighter-weight VitePress.
Common errors
-
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
cause VuePress 1.x build process consumes excessive memory, especially for large sites, leading to Node.js hitting its heap limit.fixIncrease Node.js memory allocation for the build command: `NODE_OPTIONS=--max_old_space_size=8192 yarn docs:build` (adjust size as needed, e.g., 4096, 12048). -
[Vue warn]: Failed to resolve component: XXX
cause Using non-standard or deprecated HTML tags (e.g., `<center>`, `<font>`) in Markdown or Vue templates that Vue.js does not recognize as valid components or elements.fixReplace non-standard HTML tags with modern, semantic HTML5 elements and CSS for styling. Use the `--debug` flag during development (`vuepress dev docs --debug`) to get warning logs about unrecognized tags. -
warning Overriding existing page xxx
cause Two or more Markdown files in the project resolve to the same URL path, causing one to overwrite the other during compilation. Common examples are `a/b.md` and `a/b/README.md`.fixReview your file structure and ensure each Markdown file has a unique URL path. Adjust directory structure or file names to avoid path conflicts. For example, use `a/b.md` OR `a/b/index.md`, but not both if they map to the same `/a/b/` URL. -
Hydration completed but contains mismatches
cause Server-side rendered (SSR) HTML differs from the client-side rendered content. This can be caused by external services like CloudFlare's static resource compression, or Vue components rendering differently on the server vs. client.fixIf using CloudFlare, disable 'Auto Minify' for JavaScript and HTML. For components that behave differently, wrap them in VuePress's `<ClientOnly />` component. Set `__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true` in development for detailed browser console errors.
Warnings
- breaking VuePress 1.x is in maintenance mode and not actively developed. VuePress 2.x (based on Vue 3 and pure ESM) introduces significant breaking changes and is not backward compatible. Users are encouraged to consider migrating to VuePress 2.x or VitePress for new projects or long-term maintenance.
- breaking VuePress 2.x removes support for CommonJS configuration files. All configurations (e.g., `.vuepress/config.js`) must be refactored to ESM (`.vuepress/config.ts` or `.vuepress/config.mjs`) when migrating.
- gotcha Large VuePress 1.x sites, especially with many pages or complex processing, can suffer from `FATAL ERROR: JavaScript heap out of memory` during the build process due to Webpack's memory consumption and VuePress 1.x's inefficiency with file handling.
- gotcha Custom Vue components used directly in Markdown files must adhere to Vue's component naming conventions (PascalCase or contain a hyphen). Failure to do so can cause them to be treated as inline HTML elements and wrapped in `<p>` tags, leading to client-side hydration mismatches.
- gotcha VuePress 1.x uses Stylus internally, meaning you do not need to install `stylus` and `stylus-loader` for basic styling. However, for other CSS pre-processors, you must manually extend the internal Webpack config and install the necessary dependencies.
Install
-
npm install vuepress -
yarn add vuepress -
pnpm add vuepress
Imports
- defineConfig
const { defineConfig } = require('vuepress/config')import { defineConfig } from 'vuepress/config' - defineConfig4CustomTheme
import { defineConfig4CustomTheme } from 'vuepress/config' - ClientOnly
<ClientOnly><NonSSRFriendlyComponent/></ClientOnly>
Quickstart
{
"name": "my-docs",
"version": "1.0.0",
"description": "My awesome VuePress documentation",
"main": "index.js",
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"vuepress": "^1.9.10",
"@vuepress/theme-default": "^1.9.10"
}
}
// docs/.vuepress/config.ts
import { defineConfig } from 'vuepress/config';
export default defineConfig({
title: 'Hello VuePress 1.x',
description: 'Just playing around',
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'Guide', link: '/guide/' },
{ text: 'External', link: 'https://vuejs.org' }
],
sidebar: [
'/',
'/guide/'
]
}
});
// docs/README.md
---
layout: home
---
# Hello VuePress!
This is my first VuePress 1.x site.
<ClientOnly>
<p>This paragraph only renders on the client side.</p>
</ClientOnly>