Git Product home page Git Product logo

Comments (9)

shailander avatar shailander commented on August 18, 2024 3

@steve8708 Hey Guys, update from my side. My code was un-registering the party town script before running it, so that's why the problem was occurring. Thanks for all the response and help!!

from partytown.

 avatar commented on August 18, 2024 2

@shailander May I know how did you figure out if party-town script is getting registered or not. Iā€™m facing the above same issue so.

from partytown.

shailander avatar shailander commented on August 18, 2024 2

@gowdanischal7 @cyrilcabo I had a script to register and de-register all the service workers used. Party town also operates as a service worker so my script was removing/de-registering the partytown as soon as it was initialised. I checked this through the source option in console panel where the partytown was seen initialising as also being removed when my scripts run. This was causing that error shown in the issue as partytown is itself not present during the external script load call

from partytown.

cyrilcabo avatar cyrilcabo commented on August 18, 2024 1

Ahh I see, it seems like I have a different problem. Thanks for taking the time to respond @shailander !

from partytown.

meck93 avatar meck93 commented on August 18, 2024

Hi @shailander

I think script tags don't work inside _document.tsx. You should put the Script Tags inside _app.tsx or inside the components where you want to load the Scripts according to Next.js Guide. See here:

Also, if you use Next.js built-in <Script /> tag, there are ESLint rules making sure everything is configured as it should be.

_document.tsx

import { Partytown } from '@builder.io/partytown/react';
import Document, { Head, Html, Main, NextScript } from 'next/document';
import React from 'react';

class CustomDocument extends Document {
  render(): JSX.Element {
    return (
      <Html>
        <Head>
          <Partytown forward={['dataLayer.push']} />
        </Head>
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}
export default CustomDocument;

home.tsx

import Script from 'next/script'

export default function Home() {
  return (
    <>
      <Script src="https://www.google-analytics.com/analytics.js" />
      <h1>Title</h1>
    </>
  )
}

from partytown.

shailander avatar shailander commented on August 18, 2024

Hi @meck93, thanks for the response.
Although Script doesn't work in _document but script does work if you want but is still a bad practice.
Using next Script is not even making the call to download the script, and I wanted to globally download the gtag so that's why I have to use it in _app but even after moving the scripts to the _app the problem still persists.

from partytown.

sandeshpe avatar sandeshpe commented on August 18, 2024

I'm also getting the same issue. My proxytown request is pending & when checked in partytown-sw file, it says Unexpected end of input.

from partytown.

steve8708 avatar steve8708 commented on August 18, 2024

hey @shailander - we've just created an issue template, could you update your issue here to provide all the information the template asks for? it'll help us look into your issue https://github.com/BuilderIO/partytown/issues/new?assignees=&labels=&template=bug_report.md&title=

pasting below to make things easier:


Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Reproduction link
Please include a link to a Stackblitz or Codesandbox reproducing the issue. We will need to see the issue reproduced with hand-written code - we can't debug giant minified third party scripts directly. If you do not include a clean and simple reproduction of your issue, we won't be able to look into it until you do.

Expected behavior
A clear and concise description of what you expected to happen.

Partytown version
What version of Partytown you are using, e.g. 0.0.1

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

from partytown.

cyrilcabo avatar cyrilcabo commented on August 18, 2024

@shailander I hope you can come back and tell us what you did to fix the issue šŸ˜¢ šŸ™

from partytown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.