Skip to content

Impossible to disable javascript minification #776

@mildred

Description

@mildred

Expected behavior

I have part of javascript within sprockets and part within webpack (for historical reasons difficult to revert entirely when rails promoted webpacker). The javascript generated by webpack also generates a sourcemap.

I need sprockets to serve the webpack generated js file unmodified, else the original sourcemap generated by webpack will not work.

Unless I find a way to serve the webpack generated file unmodified, I want to disable minification on all generated javascript, but I cannot either

Here is the config/initializers/assets.rb

# do not generate sourcemap because we do not modify js files
Rails.application.config.assets.debug = false

class NullTransformer
  def compress(string)
    string
  end
end

Rails.application.config.assets.compress = true
Rails.application.config.assets.js_compressor = NullTransformer.new

Actual behavior

webpack javascript file is served modified. I told webpack to not minify the generated file, but sproskets will insist of minifying it. No way to disable

System configuration

  • Sprockets version
    sprockets (4.2.0)
    sprockets-rails (3.4.2)
  • Ruby version: 3.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions