Bundler

VuePress has been using WebpackOpen in a new window as the bundler to dev and build sites. Since VuePress v2, other bundlers are also supported, and now we are using ViteOpen in a new window as the default bundler. Of course, you can still choose to use Webpack.

Choose a Bundler

When using the vuepressOpen in a new window package, Vite bundler is installed and used automatically.

If you want to use Webpack bundler instead, you can remove it and install the vuepress-webpackOpen in a new window package instead:

pnpm remove vuepress
pnpm add -D vuepress-webpack@next
yarn remove vuepress
yarn add -D vuepress-webpack@next
npm uninstall vuepress
npm install -D vuepress-webpack@next

prompt

In fact, the vuepressOpen in a new window package is just a wrapper of the vuepress-viteOpen in a new window package.

Configure Bundler

Generally, you could use a bundler without extra configuration, because we have already configured them properly to work with VuePress.

You can configure bundler for advanced usage via the bundler option:

import { viteBundler } from 'vuepress'
// import { webpackBundler } from 'vuepress-webpack'

export default {
  bundler: viteBundler({
    vuePluginOptions: {
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag === 'center',
        },
      },
    },
  }),
}

You can refer to Bundlers > Vite and Bundlers > Webpack to check out all options of the corresponding bundler.

last update:
contributor: ahong18s