You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this new gem! I'm trying to get source maps working, I apologize in advance if I misunderstood (I have a limited understanding of front-end tooling).
Source maps do seem to work in our Rails 7 app in development (using sprockets 4.0.2, sprockets-rails 3.4.2, jsbundling-rails 1.0.1 and esbuild 0.14.23): assets:precompile generates a JS bundle with a sourceMappingURL clause at the end. However they do not seem to work in production: the sourceMappingURL clause is absent in this case.
Because of this we do not have proper Javascript crash reports in our monitoring system.
We have this under package.json's scripts: "build": "esbuild app/javascript/*.* --bundle --sourcemap --target=es2016 --minify --outdir=app/assets/builds". I've tried with both config.assets.debug = false (as suggested) and config.assets.debug = true in application.rb, but this does not seem to change the situation. Some debug info below (point 3 is problematic).
When running that esbuild command, two files are generated as expected: app/assets/builds/application.js and app/assets/builds/application.js.map, where the last line of the JS file is //# sourceMappingURL=application.js.map.
When running RAILS_ENV=development bin/rails assets:precompile, two files are generated: public/assets/application-cc3245bb241eac905dc4ffd8a5abc8d3d42445e9e1986ea93ba7b267e583f1cf.js and public/assets/application.js-67cdc37aff88978cfa5a2cdba39ef49c3da8d9b6ff16f4c7eca581548009fe0c.map, and the last lines of the JS file are (which seem correct):
When running RAILS_ENV=production bin/rails assets:precompile, two files are generated: public/assets/application-6c7fc839b49f22a88c3f45c04cde931d8a6801ad0312f478165ac605915c1d55.js and public/assets/application.js-67cdc37aff88978cfa5a2cdba39ef49c3da8d9b6ff16f4c7eca581548009fe0c.map. However the JS file has no sourceMappingURL statement at the end, it ends with //!.
Is there a way to make source maps work with jsbundling-rails and esbuild?
The text was updated successfully, but these errors were encountered:
@silva96 See #58 for why --public-path=assets is desirable, but it indeed breaks sourcemaps. I've submitted rails/sprockets-rails#515 to fix this in Sprockets.
Thank you for this new gem! I'm trying to get source maps working, I apologize in advance if I misunderstood (I have a limited understanding of front-end tooling).
Source maps do seem to work in our Rails 7 app in development (using sprockets 4.0.2, sprockets-rails 3.4.2, jsbundling-rails 1.0.1 and esbuild 0.14.23):
assets:precompile
generates a JS bundle with asourceMappingURL
clause at the end. However they do not seem to work in production: thesourceMappingURL
clause is absent in this case.Because of this we do not have proper Javascript crash reports in our monitoring system.
We have this under
package.json
'sscripts
:"build": "esbuild app/javascript/*.* --bundle --sourcemap --target=es2016 --minify --outdir=app/assets/builds"
. I've tried with bothconfig.assets.debug = false
(as suggested) andconfig.assets.debug = true
inapplication.rb
, but this does not seem to change the situation. Some debug info below (point 3 is problematic).When running that
esbuild
command, two files are generated as expected:app/assets/builds/application.js
andapp/assets/builds/application.js.map
, where the last line of the JS file is//# sourceMappingURL=application.js.map
.When running
RAILS_ENV=development bin/rails assets:precompile
, two files are generated:public/assets/application-cc3245bb241eac905dc4ffd8a5abc8d3d42445e9e1986ea93ba7b267e583f1cf.js
andpublic/assets/application.js-67cdc37aff88978cfa5a2cdba39ef49c3da8d9b6ff16f4c7eca581548009fe0c.map
, and the last lines of the JS file are (which seem correct):RAILS_ENV=production bin/rails assets:precompile
, two files are generated:public/assets/application-6c7fc839b49f22a88c3f45c04cde931d8a6801ad0312f478165ac605915c1d55.js
andpublic/assets/application.js-67cdc37aff88978cfa5a2cdba39ef49c3da8d9b6ff16f4c7eca581548009fe0c.map
. However the JS file has nosourceMappingURL
statement at the end, it ends with//!
.Is there a way to make source maps work with
jsbundling-rails
andesbuild
?The text was updated successfully, but these errors were encountered: