Skip to content

Sourcemap source root not clear #3332

Open

Description

@vjpr

What version of Bun is running?

0.6.10

What platform is your computer?

macos

What steps can reproduce the bug?

What is the sourcemap root suppose to be?

- repos
  - livex
    - web
      - package.json
      - tsconfig = {compilerOptions: {root: '.', baseUrl: 'src'}}
      - src
        - index.ts <-- entrypoint
Bun.build({
  root: '/xxx',
  entryPoints: [
    "/xxx/repos/livex/web/src/index.ts", 
    "/xxx/repos/livex/server/src/bundler/foo.ts"
  ]
})
/xxx/repos/livex/web/src/index.ts
sources: [ "../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react.development.js",
  "../../../node_modules/.pnpm/react@18.2.0/node_modules/react/index.js",
  "../../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/cjs/scheduler.development.js",
  "../../../node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/index.js",
  "../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom.development.js",
  "../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js",
  "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js",
  "../../../node_modules/.pnpm/colornames@1.1.1/node_modules/colornames/colors.js",
  "../../../node_modules/.pnpm/colornames@1.1.1/node_modules/colornames/index.js",
  "../../../node_modules/.pnpm/lodash.words@4.2.0/node_modules/lodash.words/index.js",
  "../../../node_modules/.pnpm/lodash.trimstart@4.5.1/node_modules/lodash.trimstart/index.js",
  "../../../node_modules/.pnpm/lodash.padend@4.6.1/node_modules/lodash.padend/index.js",
  "../../../node_modules/.pnpm/rgb-hex@3.0.0/node_modules/rgb-hex/index.js",
  "../../../node_modules/.pnpm/hex-rgb@4.3.0/node_modules/hex-rgb/index.js",
  "../../../node_modules/.pnpm/string-to-color@2.2.2/node_modules/string-to-color/index.js",
  "../../../node_modules/.pnpm/stackframe@1.3.4/node_modules/stackframe/stackframe.js",
  "../../../node_modules/.pnpm/error-stack-parser@2.1.4/node_modules/error-stack-parser/error-stack-parser.js",
  "../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-dev-runtime.development.js",
  "../../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-dev-runtime.js",
  "../web/src/log.ts", "../web/src/websockets.ts",
  "../../../node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js",
  "../web/src/app/data/fixtures.ts", "../../../node_modules/.pnpm/nanoid@4.0.1/node_modules/nanoid/index.browser.js",
  "../web/src/app/data/model.ts", "../web/src/app/data/model.ts",
  "../web/src/app/data/seed.ts", "../store/src/index.ts",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/browser.js",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js",
  "../../../node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js",
  "../store/src/util.ts", "../store/src/util.ts",
  "../store/src/context.ts", "../store/src/emit-change.ts",
  "../store/src/source-maps/index.ts", "../store/src/emit-change.ts",
  "../store/src/use-query.ts", "../store/src/use-query.ts",
  "../log/src/index.ts", "../store/src/index.ts",
  "../store/src/index.ts", "../web/src/app/data/store.ts",
  "../web/src/app/context.ts", "../web/src/app/Packages.tsx",
  "../web/src/app/Component.tsx", "../../../node_modules/.pnpm/style-vendorizer@2.1.1/node_modules/style-vendorizer/dist/esm/bundle.min.mjs",
  "../../../node_modules/.pnpm/twind@0.16.17/node_modules/twind/twind.js",
  "../../../node_modules/.pnpm/twind@0.16.17/node_modules/twind/twind.js",
  "../../../node_modules/.pnpm/twind@0.16.17/node_modules/twind/observe/observe.js",
  "../../../node_modules/.pnpm/twind@0.16.17/node_modules/twind/shim/shim.js",
  "../web/src/app/index.tsx", "../web/src/index.ts"
]

Seems like the root is the package.json of the entrypoint...but then all paths resolve upwards to their common root, and then resolve back from there.

It seems tangled...

What is the expected behavior?

The paths should be relative to the root specified in Bun.build...

What do you see instead?

No response

Additional information

No response

Activity

  1. added
    bug
    on Jun 16, 2023
  2. added a commit that references this issue on Jan 15, 2026
    792ee03
  3. added
    confirmed bug
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmed bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions