Skip to content

[🐞] Guidance Needed: Using Partytown with Google Places API in Next.js 15 #649

@alisahindev

Description

@alisahindev

Describe the bug

Hello,

I am working on a project using Next.js 15 and aiming to integrate the Google Places API. To improve performance, I want to use Partytown to load the Google Places script in a web worker. However, I am encountering some difficulties and would appreciate guidance or examples on how to implement this setup correctly.

  1. Next.js Version: 15
  2. App Router: Enabled with experimental features.
  3. Partytown Configuration: Installed @builder.io/partytown.
  4. Configured Partytown in the public folder as per the documentation.
  5. Google Places API: Trying to load the script via Partytown to offload its execution to a web worker.

Code Snippets in layout.tsx

<Script
 src={`https://maps.googleapis.com/maps/api/js? 
 key=${process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY}&libraries=places`}
 type="text/partytown" />

<Partytown debug={true} forward={["google.maps.places"]} />

Reproduction

https://codesandbox.io/p/devbox/6h99fx

Steps to reproduce

You can see how isnt worked on codesandbox

Browser Info

Chrome

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions