You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to configure output path for source maps聽#13508
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.
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.
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?.
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.
Activity
alan-agius4 commentedon Jan 23, 2019
Hi,
What is the usecase of not deploying the sourcemaps?
If it鈥檚 for reporting purposes I suggest you use the 鈥榟idden` sourcemap which have been added recently see here #13062
alan-agius4 commentedon Jan 29, 2019
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 commentedon Aug 15, 2019
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 commentedon Aug 16, 2019
Hi @johnhamm, why would you want to deploy your sourcemaps in a 'secret' folder instead of using the
hiddensourcemaps feature within the CLI, and when you want to debug you just add the sourcemap fromGoogle Chromeusing theAdd source mapfeature?.There is quite a good article about this in https://blog.angularindepth.com/debug-angular-apps-in-production-without-revealing-source-maps-ab4a235edd85
johnhamm commentedon Aug 16, 2019
The article you linked to explains why:
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 commentedon Aug 17, 2019
There's no need to move them. Instead, just don't deploy the source map files.
angular-automatic-lock-bot commentedon Sep 17, 2019
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.