Phoenix + ReactJs and Webpack

Hello!
My stack is Phoenix + ReactJS, and I’m having trouble with generating sourcemaps.
I can generate sourcemaps with webpack that is not an issue, I got generated app.js and app.js.map, but when I run phx.digest I got different hash keys for files. For example:
app-bc9a5512d39b34f2f7207b33c448373a.js
app.js-98781a50031ed5c86aa6b16877bbcd6f.map

Any ideas of how can overcome this issue?
Thanks!

Hi, as long as your JavaScript file points to //# sourceMappingURL=./app.js-[hash].map (should be at the end), the source map will load, even if it doesn’t have the same hash as the JavaScript file.

Remember to configure your web server to disallow access for normal users to the source map.

1 Like