Skip to content

Ability to configure output path for source maps #13508

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

Closed
stevejagodzinski opened this issue Jan 23, 2019 · 7 comments
Closed

Ability to configure output path for source maps #13508

stevejagodzinski opened this issue Jan 23, 2019 · 7 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@stevejagodzinski
Copy link

stevejagodzinski commented Jan 23, 2019

🚀 Feature request

Ability to configure output path for source maps

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

When I create a production build using ng build -prod --sourcemaps,
I would like the ability to configure the output path for the source map files,
So that my source maps will not be deployed with my application.

Describe the solution you'd like

A dedicated --source-map-output-path build command to configure the output path of the source maps only.

The output of the build should continue to go to --output-path=./dist
The source maps should go to the path specified by --source-map-output-path

Describe alternatives you've considered

The current solution is a post-build script that moves the *.map files from the --output-path=./dist directory into a different target directory.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jan 23, 2019

Hi,

What is the usecase of not deploying the sourcemaps?

If it’s for reporting purposes I suggest you use the ‘hidden` sourcemap which have been added recently see here #13062

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Jan 23, 2019
@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue

Closing as hidden, should be enough. If you have another use case. Kindly open a new issue explaining why you cannot use hidden.

Thanks.

@johnhamm
Copy link

A use case would be using "hidden" sourcemaps on a production deployment. You would name the subfolder under dist something secret, then add the sourcemaps when you want to debug the production deploy using that URL subdirectory.

@alan-agius4
Copy link
Collaborator

Hi @johnhamm, why would you want to deploy your sourcemaps in a 'secret' folder instead of using the hidden sourcemaps feature within the CLI, and when you want to debug you just add the sourcemap from Google Chrome using the Add source map feature?.

There is quite a good article about this in https://blog.angularindepth.com/debug-angular-apps-in-production-without-revealing-source-maps-ab4a235edd85

@johnhamm
Copy link

The article you linked to explains why:

Uploading source maps from your local machine is quite nice. But still, it requires some manual steps that each developer has to execute. Finding the matching commit, regenerate source maps and upload them. Can we get rid of some of them?

Again we start off by setting the hidden property in our angular.json.
"sourceMap": {
"hidden": true,
"scripts": true,
"styles": true
}
Next up we need to hide our source maps. We merely create another folder in our dist and move the source maps to it.
"postbuild": "mkdir dist/sourceMapInspector/sourceMaps; mv dist/sourceMapInspector/*.map dist/sourceMapInspector/sourceMaps"
You are free to choose the directory name. Instead of sourceMaps you can also choose some name that is hard or impossible to guess.

You'd still use the hidden feature, but you'd move the source maps to a subfolder which you would publish along with the website into a subdirectory name.

The advantages are obvious - the developer doesn't have to find the matching commit, generate the sourcemaps, and upload them. Instead, they can merely add them using the subdirectory from whatever deploy they are accessing.

@clydin
Copy link
Member

clydin commented Aug 17, 2019

There's no need to move them. Instead, just don't deploy the source map files.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

4 participants