diff --git a/.changeset/lucky-bats-lie.md b/.changeset/lucky-bats-lie.md new file mode 100644 index 0000000000..29b4b3382b --- /dev/null +++ b/.changeset/lucky-bats-lie.md @@ -0,0 +1,38 @@ +--- +'@reown/appkit-utils': patch +'@apps/demo': patch +'@apps/gallery': patch +'@apps/laboratory': patch +'@examples/html-ethers': patch +'@examples/html-ethers5': patch +'@examples/html-wagmi': patch +'@examples/next-ethers': patch +'@examples/next-wagmi': patch +'@examples/react-ethers': patch +'@examples/react-ethers5': patch +'@examples/react-solana': patch +'@examples/react-wagmi': patch +'@examples/vue-ethers5': patch +'@examples/vue-solana': patch +'@examples/vue-wagmi': patch +'@reown/appkit-adapter-ethers': patch +'@reown/appkit-adapter-ethers5': patch +'@reown/appkit-adapter-polkadot': patch +'@reown/appkit-adapter-solana': patch +'@reown/appkit-adapter-wagmi': patch +'@reown/appkit': patch +'@reown/appkit-cdn': patch +'@reown/appkit-common': patch +'@reown/appkit-core': patch +'@reown/appkit-ethers': patch +'@reown/appkit-ethers5': patch +'@reown/appkit-polyfills': patch +'@reown/appkit-scaffold-ui': patch +'@reown/appkit-siwe': patch +'@reown/appkit-solana': patch +'@reown/appkit-ui': patch +'@reown/appkit-wagmi': patch +'@reown/appkit-wallet': patch +--- + +Changed logger imports to not cause the webpack bundler to throw a CommonJS module error. \ No newline at end of file diff --git a/packages/appkit-utils/src/LoggerUtil.ts b/packages/appkit-utils/src/LoggerUtil.ts index 9dd2507093..71c0d9e66c 100644 --- a/packages/appkit-utils/src/LoggerUtil.ts +++ b/packages/appkit-utils/src/LoggerUtil.ts @@ -1,10 +1,16 @@ -import { pino } from '@walletconnect/logger' +import { generatePlatformLogger, getDefaultLoggerOptions } from '@walletconnect/logger' export const LoggerUtil = { createLogger(onError: (error: Error, ...args: unknown[]) => void, level = 'error') { - const pinoLogger = pino({ level }) + const loggerOptions = getDefaultLoggerOptions({ + level + }) - pinoLogger.error = (...args: unknown[]) => { + const { logger } = generatePlatformLogger({ + opts: loggerOptions + }) + + logger.error = (...args: unknown[]) => { for (const arg of args) { if (arg instanceof Error) { onError(arg, ...args) @@ -15,6 +21,6 @@ export const LoggerUtil = { onError(new Error(), ...args) } - return pinoLogger + return logger } }