Angular-cli: Remote sourcemappingurl support

Created on 9 Nov 2017  路  5Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Desired functionality.

I'd like to be able to have a the options intsconfig.compilerOptions.* that pertain to sourceMap config to be configurable.

I'm trying to build production assets that have a sourceMapping like the following

//# sourceMappingURL=http://localhost:4200/inline.bundle.js.map

to facilitate debugging by developers in production environments.

To do this I expected to be able to change the tsconfig.compilerOptions.mapRoot to http://localhost:4200/. However it looks like

https://github.com/angular/angular-cli/blob/master/packages/@ngtools/webpack/src/angular_compiler_plugin.ts#L187-L201

    if (options.sourceMap) {
      this._compilerOptions.sourceMap = true;
      this._compilerOptions.inlineSources = true;
      this._compilerOptions.inlineSourceMap = false;
      this._compilerOptions.mapRoot = undefined;
      // We will set the source to the full path of the file in the loader, so we don't
      // need sourceRoot here.
      this._compilerOptions.sourceRoot = undefined;
    } else {
      this._compilerOptions.sourceMap = false;
      this._compilerOptions.sourceRoot = undefined;
      this._compilerOptions.inlineSources = undefined;
      this._compilerOptions.inlineSourceMap = undefined;
      this._compilerOptions.mapRoot = undefined;
      this._compilerOptions.sourceRoot = undefined;
    }

Overrides the config and doesn't honor what's in the tsconfig.json

Thoughts and opinions appreciated.

help wanted 3 (nice to have) feature

Most helpful comment

+1 for this. Trying to set up private sourcemaps for production error reporting.

All 5 comments

+1 for this. Trying to set up private sourcemaps for production error reporting.

I agree. This is undesired behavior. It should only provide a default config instead of overwriting it.

+1 for this. Inline source maps are necessary for debugging in something like Cordova and this code overwrites any custom settings.

Hi, closing this as for error reporting one should use hidden sourcemaps which is a type of sourcemaps specifically used for error reporting productions and solutions.

You can enable this via the configuration.

example;

"build": {
    "builder": "@angular-devkit/build-angular:browser",
    "configurations": {
        "production": {
            "sourceMap": {
                "hidden": true,
                "scripts": true,
                "styles": true
            },
            ...
        }
    }
}

Regarding inline sourcemaps there is another open issue here: https://github.com/angular/angular-cli/issues/13543

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._

Was this page helpful?
0 / 5 - 0 ratings