Nuxt

There is a first-class Nuxt integration for partytown.

Install

Add @nuxtjs/partytown dependency to your project.

yarn add --dev @nuxtjs/partytown # or npm install --save-dev @nuxtjs/partytown

Configure

Add @nuxtjs/partytown to the modules section of nuxt.config.ts. Use the partytown property for the configuration.

import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
  modules: ['@nuxtjs/partytown'],
  partytown: {
    /* any partytown-specific configuration */
  },
});

Partytown Script

Add type: 'text/partytown' attribute to any scripts you want to be handled by partytown.

<template>
  <div>
    <Script type="text/partytown" src="https://example.com/analytics.js" />
  </div>
</template>

Note that the Nuxt Partytown module already handles copying the library files to the correct location.

Builder.io is the headless CMS that lets you drag & drop with your components.

Made with ❤️ by

© 2023 Builder.io, Inc.