fullstorydev / fullstory-browser-sdk

Official FullStory SDK for JavaScript, for web browsers
MIT License
55 stars 17 forks source link

fs.js is loaded twice #198

Open dsacramone opened 1 month ago

dsacramone commented 1 month ago

I am using v2 of the snippet in my NextJS (latest version) app. I don't want to load it instantly so I am importing it as I need it. But, I notice two fs.js files are loaded. The initial iniator is my code init()... BUT, the second initiator is the first "fs.js". It's calling itself to load. Also

Here is my code calling the v2 version: // Dynamically import FullStory import('@fullstory/browser') .then(({ init, FullStory }) => { init({ orgId: '*****' }); }) .catch((err) => { console.error('Error loading FullStory:', err); });

That loads the first "fs.js" - BUT a few moments later, another "fs.js" script appears in the console from this code, from the first fs.js file:

var u = n.createElement("script");
                u.async = !0,
                u.crossOrigin = "anonymous",
                u.src = "".concat(i, "//").concat(r),
                "testdrive" == e && (u.src += "?allowMoo=true"),
                n.head.appendChild(u)
Screenshot 2024-10-14 at 2 20 04 PM