Code Monkey home page Code Monkey logo

Comments (16)

Jaco-Pretorius avatar Jaco-Pretorius commented on September 22, 2024 3

@itsalongstory Ah, ok - that explains it.

The README does say UglifyJS only works with ES5. If you need to compress ES6, [ruby-terser](https://github.com/ahorek/terser-ruby) is a better option.

I switched to terser and that solved my problem, so I think that's the resolution for this issue. If terser doesn't work for you I would suggest opening an issue against the terser repo.

from uglifier.

itsalongstory avatar itsalongstory commented on September 22, 2024 1
# gem 'uglifier', '~> 4.2'
gem 'terser', '~> 1.1', '>= 1.1.12'
# config.assets.js_compressor = Uglifier.new(harmony: true)
config.assets.js_compressor = :terser

from uglifier.

itsalongstory avatar itsalongstory commented on September 22, 2024 1

No way! I don't see a solution, so I stayed on Bootstrap v5.1.3 for now. The fact is that technology is advancing, and RoR is no longer keeping up with them.

I think we should first understand why it's blowing up. It's not clear to me if the issue is in uglifier or in Bootstrap.

I think the problem is uglifier doesn't full support ES6, and Bootstrap 5.2 has some new ES6 code.

from uglifier.

bekkou68 avatar bekkou68 commented on September 22, 2024 1

I faced a similar problem. And I solved the problem by switching to terser. Thanks.

from uglifier.

Sega100500 avatar Sega100500 commented on September 22, 2024

Some refer to the need to use a terser , but terser does'nt work properly at this case too.

from uglifier.

dave105010 avatar dave105010 commented on September 22, 2024

Sorry I found this issue while looking into something else about terser/rails on Google. What's the problem here exactly? rails assets:precompile generates the minified JS when the command is explicitly executed on terminal? Why uglifier is running on application runtime anyway? So weird. Maybe it shouldn't run at all. Uglifier devs should fix that.

Does the minified js file work when you remove uglifier gem and rebooted the application?

from uglifier.

Sega100500 avatar Sega100500 commented on September 22, 2024

@dave105010
Because I don't use rails assets:precompile any time but I use config.assets.compile = true in config file (see the issue).

In development mode, everything works fine until :uglifier is used. The JS code and CSS styles has nothing to do with it at all.

from uglifier.

Jaco-Pretorius avatar Jaco-Pretorius commented on September 22, 2024

+1 Also seeing this exact same issue when upgrading Bootstrap in both Development and Production

I'm seeing this when I run assets:precompile:

rails aborted!
Uglifier::Error:
/Users/my-username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/uglifier-4.2.0/lib/uglifier.rb:293:in `parse_result'
/Users/my-username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
/Users/my-username/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'

The result parameter in parse_result (which I found by adding some debug statements) is {"error"=>{}}

from uglifier.

Sega100500 avatar Sega100500 commented on September 22, 2024

@itsalongstory
terser have same problem. It' not solution!

from uglifier.

itsalongstory avatar itsalongstory commented on September 22, 2024

terser have same problem. It' not solution!

So, how did you get Uglifier to handle Bootstrap 5.2 correctly now?

from uglifier.

Sega100500 avatar Sega100500 commented on September 22, 2024

@itsalongstory
No way! I don't see a solution, so I stayed on Bootstrap v5.1.3 for now. The fact is that technology is advancing, and RoR is no longer keeping up with them.

from uglifier.

itsalongstory avatar itsalongstory commented on September 22, 2024

terser have same problem. It' not solution!

Can you describe a little bit about the problems you've encountered with terser?

from uglifier.

Sega100500 avatar Sega100500 commented on September 22, 2024

@itsalongstory
Same problem as uglifier - not work correctly when I use Bootstrap 5.2

from uglifier.

itsalongstory avatar itsalongstory commented on September 22, 2024

Same problem as uglifier - not work correctly when I use Bootstrap 5.2

In my project, uglifier does not work with Bootstrap 5.2, but terser works fine with Bootstrap 5.2

from uglifier.

Jaco-Pretorius avatar Jaco-Pretorius commented on September 22, 2024

No way! I don't see a solution, so I stayed on Bootstrap v5.1.3 for now. The fact is that technology is advancing, and RoR is no longer keeping up with them.

I think we should first understand why it's blowing up. It's not clear to me if the issue is in uglifier or in Bootstrap.

from uglifier.

guilhermeyo avatar guilhermeyo commented on September 22, 2024

@bekkou68 me too, thanks.

from uglifier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.