Skip to content

Webpacker gem generates incorrect manifest.json on windows 10 #1174

@cshupp1

Description

@cshupp1

I am using:

    webpacker (3.2.0)
    rails (5.1.4)
    JRuby 9.1.15.0

Suppose in /app/javascript/packs/hello I have:

hello_react.jsx

On Windows the manifest generated is:

{
  "application.js": "/packs/application-0dc18709a85406b5e3f5.js",
  "application.js.map": "/packs/application-0dc18709a85406b5e3f5.js.map",
  "hello\\hello_react.js": "/packs/hello\\hello_react-5a67faa5e91dd316f476.js",
  "hello\\hello_react.js.map": "/packs/hello\\hello_react-5a67faa5e91dd316f476.js.map"
}

This means in my erb file this does not work:

<%=javascript_pack_tag 'hello/hello_react'  %>

I must do this:

<%=javascript_pack_tag 'hello\hello_react'  %>

for a lookup to succeed.

Workaround:

class String
  def os_path!
      self.gsub!('/', java.io.File::separator)
      self.gsub!('\\', java.io.File::separator)
  end
end

in erb:

<%=javascript_pack_tag 'hello/hello_react'.os_path!  %>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions