Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to disable javascript minification #776

Open
mildred opened this issue Jan 16, 2023 · 0 comments
Open

Impossible to disable javascript minification #776

mildred opened this issue Jan 16, 2023 · 0 comments

Comments

@mildred
Copy link

mildred commented Jan 16, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant