Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --treat-source-as-minified option for sourcemaps inject command #1956

Closed
wants to merge 3 commits into from

Conversation

Zozman
Copy link

@Zozman Zozman commented Feb 22, 2024

Issue

As described in #1955, the sourcemaps inject command cannot handle certain minified files if it has particular syntax (template literals without a sourceMappingURL for example) and will be unable to tell that a file is a minified file that needs to have Debug IDs injected. Users should be able to say "hey I know everything in this directory is something that I want IDs injected into".

Therefore this PR is a proposal for adding a --treat-source-as-minified option that will force sentry-cli to override the is_likely_minified_js check and instead treat the imput as if it was minified. Then the tool will inject Debug IDs no matter what.

Example Usage And Output

sentry-cli sourcemaps inject ./dist --treat-source-as-minified --log-level=debug
  DEBUG   2024-02-22 04:42:05.930388638 +00:00 sentry-cli version: 2.28.6, platform: "linux", architecture: "x86_64"
  INFO    2024-02-22 04:42:05.932234263 +00:00 sentry-cli was invoked with the following command line: "/bin/sentry-cli" "sourcemaps" "inject" "./dist" "--treat-source-as-minified" "--log-level=debug"
> Searching ./dist
> Found 2 files
> Analyzing 2 sources
> Injecting debug ids

Source Map Debug ID Injection Report
  Modified: The following source files have been modified to have debug ids
    1f7a44af-c70b-599e-b3bc-e021cb2d7bfa - ./dist/bundle.js
  Modified: The following sourcemap files have been modified to have debug ids
    1f7a44af-c70b-599e-b3bc-e021cb2d7bfa - ./dist/bundle.js.map

This PR is provided merely as a proposal as y'all might want to handle this a different way / syntax / methodology and is merely presented as one idea for dealing with #1955.

@Zozman
Copy link
Author

Zozman commented Mar 4, 2024

Closing as #1958 takes care of #1955 in a more generic manor.

@Zozman Zozman closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant