Skip to content

Sourcemap doesn't work by default #783

Open
@viraptor

Description

@viraptor

I was hoping to use the sourcemaps after upgrading to sprockets v4. Unfortunately they're not generated.
Originally I was using uglifier, but switched to the recommended :terser option.

I'm running sprockets through rails 6.1 with config:

config.assets.js_compressor = :terser
config.assets.gzip = false
config.assets.compile = false
config.assets.digest = true
config.assets.debug = false

and running the assets:precompile job to trigger sprockets.

System configuration

  • Sprockets version: sprockets 4.2.0, sprockets-rails 3.4.2
  • Ruby version 3.1.3

Example App (Reproduction) - THIS IS IMPORTANT YOUR ISSUE LIKELY WILL NOT BE RESOLVED WITHOUT THIS

https://github.com/viraptor/sprockets-no-map-example/commits/master

3 commits:

  • clean rails 6.1.3
  • add the terser gem
  • add a js file and add it to the compiled assets

After running RAILS_ENV=production bundle exec rails assets:precompile I get only these files - no maps generated:

$ find public/assets
public/assets
public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
public/assets/index-cdc242f925b3a102342a9e8f026cb6617436f4f17eb368f77b5e28622e4fafa8.js.gz
public/assets/manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js
public/assets/manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js.gz
public/assets/index-cdc242f925b3a102342a9e8f026cb6617436f4f17eb368f77b5e28622e4fafa8.js
public/assets/.sprockets-manifest-57569ca90afe16dad20155602c4f4bb0.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions