file assigned sourcemappingurl, but already has one JS – Code Example

In this article we will show you the code to resolve the warning -file- is being assigned a //# sourceMappingURL, but already has one. This is generally raised when there is a map file but you specified it again in your javascript file.

Code Example –

You have 2 ways to define a source file in your javascript –

1. Using comment – Add the comment in JS file

//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map

2. Using header – Set this header in your JS file

X-SourceMap: /path/to/file.js.map

Source: MDN