Bundler

VuePress has been using Webpackopen in 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 new window as the default bundler. Of course, you can still choose to use Webpack.

Choose a Bundler

When using the vuepressopen in 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 new window package instead:

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

TIP

In fact, the vuepressopen in new window package is just a wrapper of the vuepress-viteopen in 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:

const { viteBundler } = require('vuepress')
// const { webpackBundler } = require('vuepress-webpack')

module.exports = {
  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.