6

I use source map for js files both on production and dev server, so I just load it from the local store. In this case, I use next string at the end of files //# sourceMappingURL=file:////var/www/static/. which points at my local store. But I want to use it on both operation system Linux and Windows. So for Windows, this string is not valid file:////var/www/static/, I should use file:////C:/www/static/. In this case on Linux browser can get this file. Is any possibility to use some universal reference which will work in both OS

Barny Gamble
  • 85
  • 1
  • 6
  • The sourcemap tells the **client** how to load the file. The client should have no concept of your servers actual filesystem. – zero298 Apr 20 '17 at 17:29

1 Answers1

2

The sourcemap tells the client how to load the file. The client should have no concept of your servers actual filesystem.

The mapping should really be: # sourceMappingURL=/path/to/file.js.map where /path/to/file.js.map would resolve to: http://www.example.com/path/to/file.js.map

The client is completely agnostic to filesystems.

Additionally, you should not be service resources over the file:// protocol.

zero298
  • 25,467
  • 10
  • 75
  • 100
  • what is the problem with file:// protocol. Why I should use http://www.example.com/path/to/file.js.map, if I want hide map files on production how I can do this in this case. I just want to create one gulpfile.js which will nice work with different os and will be good for dev and production. – Barny Gamble Apr 20 '17 at 17:52