bugsnag / bugsnag-source-maps

CLI and JS library for uploading source maps to BugSnag
MIT License
16 stars 9 forks source link

`--project-root` doesn't expand relative paths #88

Open aaronklinker-st opened 1 year ago

aaronklinker-st commented 1 year ago

Describe the bug

I have a monorepo, whose sourcemaps rely on node modules in the root directory as well as the app directory. I tried setting --project-root option to ../.., but that didn't work. When running the below commands, the uploader doesn't expand the relative path, and thus fails to strip the project root from the source maps.

cd apps/app-name
bugsnag-source-maps upload-browser --project-root ../.. --dist apps/app-name/dist

This should either be documented or the path should be expanded if stripProjectRoot requires an absolute path.

The work around is to pass an absolute path for this URL, but that's very inconvenient.

pushd ../../
PROJECT_PATH="$(pwd)"
popd
bugsnag-source-maps upload-browser --project-root "$PROJECT_ROOT" --dist apps/app-name/dist

Steps to reproduce

  1. Run above command with a relative path for --project-root

Environment

Example code snippet

bugsnag-source-maps upload-browser --project-root ../.. --dist apps/app-name/dist
mclack commented 1 year ago

Hi @aaronklinker-st

Thanks for highlighting this with us.

We are currently aware of some incompatibilities when it comes to monorepos working with @bugsnag/source-maps. We also have an item on our backlog to look into making some changes, where I have made a note of the issue you're experiencing. We can't currently give an ETA on when this may be looked at, but we will make sure to update this thread with any developments.

While we appreciate that the workaround you provided is not ideal, we recommend continuing with this method until we work on support for monorepos.

aaronklinker-st commented 1 year ago

Thanks! Since a workaround exists, no rush!