Skip to content

Conversation

@harlan-zw
Copy link
Collaborator

@harlan-zw harlan-zw commented Jan 15, 2026

πŸ”— Linked issue

Resolves #182

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add Partytown web worker support for loading third-party scripts off the main thread.

Features:

  • partytown: true option on useScript - sets type="text/partytown"
  • scripts.partytown: ['googleAnalytics', 'plausible'] shorthand in nuxt.config
  • Auto-configures @nuxtjs/partytown forward array for supported scripts
  • Warns if script has no known forwards configured

Supported scripts with auto-forwarding:
googleAnalytics, plausible, fathom, umami, matomo, segment, metaPixel, xPixel, tiktokPixel, snapchatPixel, redditPixel, cloudflareWebAnalytics

Usage:

// nuxt.config.ts - just list the scripts, forwards are auto-configured!
export default defineNuxtConfig({
  modules: ['@nuxtjs/partytown', '@nuxt/scripts'],
  scripts: {
    partytown: ['googleAnalytics', 'plausible'],
    registry: {
      googleAnalytics: { id: 'G-xxx' },
      plausible: { domain: 'example.com' }
    }
  }
  // No need to manually configure partytown.forward!
})

Tests:

  • Unit test for registry config flow
  • E2E test verifying type="text/partytown" attribute
  • E2E integration test with @nuxtjs/partytown module
  • All 125 tests passing

πŸ€– Generated with Claude Code

@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
scripts-docs Error Error Jan 15, 2026 3:48pm
scripts-playground Ready Ready Preview, Comment Jan 15, 2026 3:48pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt/scripts/@nuxt/scripts@576

commit: 842f32f

- Add `partytown?: boolean` option to useScript
- Sets `type="text/partytown"` when enabled for web worker execution
- Add `partytown: ['googleAnalytics', ...]` shorthand in module config
- Add dev warnings for incompatible scripts (GTM, Hotjar, chat widgets, etc)
- Add docs for partytown option and compatibility notes
- Add e2e tests with @nuxtjs/partytown integration

Closes #182

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add web worker support (Partytown)

2 participants