Skip to content

Xray fails to inject itself when using jQuery in Webpacker #106

@phoozle

Description

@phoozle

Not sure if anyone has had this issue before or I have misconfigured something badly but as far as I can tell xray-rails will not work when using jQuery from Webpacker due it scanning your html for a jQuery script tag in your

Gem versions I am using:
Rails: v5.2.3
Sprockets: v3.7.2
Xray: 0.3.2

Offending line:

# middleware.rb
if append_js!(body, 'jquery', 'xray')
  inject_xray_bar!(body)
end

Workaround:
Create an empty jquery.js somewhere so that it is included in your application.js manifest file which allows X-ray to append itself. Make sure that your Webpack bundle that includes jQuery is loaded before your sprockets application.js. E.g.

  <%= javascript_pack_tag 'application' %>
  <%= javascript_include_tag 'application' %>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions