MetaMask / MetaMask/providers

Attempted import error: 'detect-browser' does not contain a default export (imported as '$detectbrowser').

Open
#353 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
268
Forks
130
PR merge metrics
No merged PRs in 30d

Description

The packaging tool will package `import { detect } from 'detect-browser';` into the following code

```
import $detectbrowser from "detect-browser";
const { detect } = $detectbrowser;
```
![image](https://github.com/user-attachments/assets/f054bf6d-e4e3-4b26-826c-5637dc32ac35)

Cause nextjs environment to report errors
![image](https://github.com/user-attachments/assets/7f13cb68-3524-4c41-9c9c-ef3a93c6461c)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the shown named import in a Next.js environment and compare it with the packaged output that introduces a default import. Trace the package entry point and export handling used for detect-browser. Done means the named import no longer produces the reported default-export error.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.