Uncaught ReferenceError: Cannot access 'yC' before initialization

Having problems importing a third party library with Plasmo. I'm using CSUI with React. The element I'm working on is a single anchor Everything seemingly smooth on VSCode and terminal but when I go to inspect the page the titular problem pops up yC is the bundled name for PrivyProvider, the component that wraps the element Checking some support discussions on the library itself I've seen that some users were seemingly able to integrate this via contentscript, but I do not have access to the source code and they weren't using Plasmo
import { PrivyProvider } from "@privy-io/react-auth"
import cssText from "data-text:~/contents/style.css"
import type {
PlasmoCSConfig,
PlasmoCSUIAnchor,
PlasmoGetInlineAnchor
} from "plasmo"

import { PRIVY_APP_ID } from "../constants/env"

export const getStyle = () => {
const style = document.createElement("style")
style.textContent = cssText
return style
}

export const config: PlasmoCSConfig = {
matches: ["https://x.com/*"]
}

export const getInlineAnchor: PlasmoGetInlineAnchor = async () =>
document.querySelector(`body`)

// Use this to optimize unmount lookups
export const getShadowHostId = ({ element }) => `shadow-host-inline-modal`

export default function InlineModal({ anchor }: { anchor?: PlasmoCSUIAnchor }) {
console.log(PRIVY_APP_ID)
return (
<PrivyProvider appId={PRIVY_APP_ID}>hello world</PrivyProvider>
)
}
import { PrivyProvider } from "@privy-io/react-auth"
import cssText from "data-text:~/contents/style.css"
import type {
PlasmoCSConfig,
PlasmoCSUIAnchor,
PlasmoGetInlineAnchor
} from "plasmo"

import { PRIVY_APP_ID } from "../constants/env"

export const getStyle = () => {
const style = document.createElement("style")
style.textContent = cssText
return style
}

export const config: PlasmoCSConfig = {
matches: ["https://x.com/*"]
}

export const getInlineAnchor: PlasmoGetInlineAnchor = async () =>
document.querySelector(`body`)

// Use this to optimize unmount lookups
export const getShadowHostId = ({ element }) => `shadow-host-inline-modal`

export default function InlineModal({ anchor }: { anchor?: PlasmoCSUIAnchor }) {
console.log(PRIVY_APP_ID)
return (
<PrivyProvider appId={PRIVY_APP_ID}>hello world</PrivyProvider>
)
}
1 Reply
krauser
krauserOP•2w ago
error may stem from here, could this be a parcel problem? // bundled code
const logger = new (0,
_logger.Logger)((0,
_version.version));
const logger = new (0,
_logger.Logger)((0,
_version.version));
index.ts:44 Uncaught TypeError: (0 , _logger.Logger) is not a constructor
at fs5la.@ethersproject/abstract-provider (index.ts:44:1)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at bsCcY.f175366506a81f2a (index.mjs:1:188)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at 9F5Oj.react/jsx-dev-runtime (InlineModal.tsx:2:1)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at iu8U6.react/jsx-dev-runtime (InlineModal.tsx:20:1)
index.ts:44 Uncaught TypeError: (0 , _logger.Logger) is not a constructor
at fs5la.@ethersproject/abstract-provider (index.ts:44:1)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at bsCcY.f175366506a81f2a (index.mjs:1:188)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at 9F5Oj.react/jsx-dev-runtime (InlineModal.tsx:2:1)
at newRequire (InlineModal.1833d2ff.js:72:24)
at localRequire (InlineModal.1833d2ff.js:85:35)
at iu8U6.react/jsx-dev-runtime (InlineModal.tsx:20:1)
Want results from more Discord servers?
Add your server