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

Uglify changing order of declaration #161

Open
adam-ludgate opened this issue Mar 9, 2019 · 0 comments
Open

Uglify changing order of declaration #161

adam-ludgate opened this issue Mar 9, 2019 · 0 comments

Comments

@adam-ludgate
Copy link

adam-ludgate commented Mar 9, 2019

Rails 4.2.11 project

I'm using JQuery among other things and when I do assets precompile with Uglify disabled, I get the Jquery code declared at the very top of the outputted application JS code (as expected)

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require jquery-ui/effect.all
//= require bootstrap.min
//= require uSidebars.min
//= require moment
//= require bootstrap-datetimepicker
//= require bootstrap-toggle.min
//= require bootstrap-treeview
//= require utilities
etc...

However, when I enable uglify

config.assets.js_compressor = Uglifier.new(harmony: true,  compress: { unused: false })

After precompilation is completed, now my application's utilities JS code (which is dependent on Jquery) appears at the top of the outputted precompiled JS code and this causes my application to fail (unable to find Jquery declared)

Is this possibly an issue with sprockets/uglifier working together? Why would uglifier shuffle the order of the JS code to not match application.js ordering?

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