6

I am using angular 6.

I want to debug an app in PROD, I need source map for that. When I create a build with source map on, it injects the URL at end of minified file as

//# sourceMappingURL=app.min.js.map

This makes browser call the sourcemap and code is visible in prod.

The question is how do I make the sourcemap but don't include the URL?

I can do that as post build using gulp and other tools but is there any outofbox / simple way?

0

2 Answers 2

5

It seems that this is doable, by configuring hidden: true for the sourceMap parameter, like this:

"sourceMap": { "scripts": true, "styles": true, "hidden": true, "vendor": true }

It seems that sourceMap can be either a bool or a complex object. Please look at the angular docs here.

Sign up to request clarification or add additional context in comments.

Comments

-2

We have to turn soureMap to 'true' in order to view and debug the .TS code with the PROD build.

In angular.json

"configurations": {
....
"production":{
...,
"sourceMap": true,
}
}

The above is working fine for me and able to debug the code.

1 Comment

This will include the source map enable and available to debug for everybody. I want sourcemap to be generated but reference not included in the minified filed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.