Nuxt Quick Start

Quick start guide for Codecov Bundle Analysis and Nuxt.

Step 1: Install the Codecov Nuxt Plugin

To install the @codecov/nuxt-plugin to your project, use the following commands.

npm install @codecov/nuxt-plugin --save-dev
yarn add @codecov/nuxt-plugin --dev
pnpm add @codecov/nuxt-plugin --save-dev

Step 2: Configure the bundler plugin

Add the plugin to the end of your modules array found inside your nuxt.config.js file, and pass your configuration.

You can find a Codecov upload token on the Configuration page for your repository, under General, or your organization settings page in the Codecov UI. For more information, see the documentation.

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  builder: "vite",
  modules: [
    // Put the Codecov Nuxt module after all other modules.
    [
      "@codecov/nuxt-plugin",
      {
        enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
      	bundleName: "<bundle project name>",
      	uploadToken: process.env.CODECOV_TOKEN,
      }
    ]
  ],
});

Step 3: Commit and push your latest changes

The plugin requires at least one commit to be made to properly upload bundle analysis information to Codecov.

git add -A && git commit -m "Add Codecov bundler plugin" && git push

Step 4: Build the Application

When building your application the plugin will automatically upload the stats information to Codecov.

npm run build
yarn run build
pnpm run build