Skip to content

Source mapping issue when debugging in browser #10372

@wighawag

Description

@wighawag

Describe the bug

When I use @ethersproject/ethers (https://github.com/ethers-io/ethers.js) in my vite project I get source mapping issues when debugging in browser.

In a monorepo setup it cannot even find the files and I get error like

Error while fetching an original source: request failed with status 404
Source URL: <unknown>

in a simple folder setup, the lines are offf

I created 2 repo to reproduce the issue

monorepo : https://github.com/bug-reproduction/vite-ethers-monorepo
simple folder: https://github.com/bug-reproduction/vite-ethers

The setup is using vite svelte-ts template

Reproduction

https://github.com/bug-reproduction/vite-ethers-monorepo

Steps to reproduce

  1. pnpm i
  2. pnpm dev
  3. navigate to http://localhost/5173
  4. try to set a breakpoint in node_modules/.pnpm/@ethersproject+bignumber@5.7.0/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts (http://localhost:5173/node_modules/.pnpm/@ethersproject+bignumber@5.7.0/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts)

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 384.61 MB / 15.43 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.17.1 - ~/.volta/tools/image/node/16.17.1/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 8.15.0 - ~/.volta/tools/image/node/16.17.1/bin/npm
  Browsers:
    Chromium: 105.0.5195.125
    Firefox: 105.0.2

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: deps optimizerEsbuild Dependencies Optimizationfeat: sourcemapSourcemap supportp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions