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

manifest.json in Hot Reload mode. Is it really required? #20

Open
iJackUA opened this issue Jun 21, 2017 · 11 comments
Open

manifest.json in Hot Reload mode. Is it really required? #20

iJackUA opened this issue Jun 21, 2017 · 11 comments

Comments

@iJackUA
Copy link

iJackUA commented Jun 21, 2017

As I understand, hash from mafiest is not used in Hot reload mode.
And I can omit including manifest loader in WebPack config for Dev env.
Maybe it is worth to check hot reloading mode in javascript_pack_tag here https://github.com/shakacode/webpacker_lite/blob/master/lib/webpacker_lite/helper.rb#L63 similar to the way CSS is handled https://github.com/shakacode/webpacker_lite/blob/master/lib/webpacker_lite/helper.rb#L57
and omit Manifest.lookup ?

@justin808
Copy link
Member

justin808 commented Jun 26, 2017

@robwise Do you agree with this one? It seems very similar to the DLL thing. Could we handle this the same way with an ENV value that is set, so we don't have to use another flag in the helper?

Possibly we could have an env specific value like webp

@iJackUA See #21 and #22.

@e-kuzminov-md
Copy link

@justin808 as I understand "unmanifested" helpers do not use Manifest in any case, but I need one helper method that uses Manifest in Production and does not use Manifest in Dev mode.
So for me it looks like slightly different use cases.
Of course I can make dirty solution with combination of "manifested" and "unmanifested" + if/then/else in template, but it would be not ideal :)

@robwise
Copy link

robwise commented Jun 26, 2017

Of course I can make dirty solution with combination of "manifested" and "unmanifested" + if/then/else in template, but it would be not ideal :)

That's what I did in our code based on the unmanifested concept, as the bundles are not named the same thing so I wouldn't be able to use a helper like this anyway:

# helpers/webpack_helper.rb
def vendor_bundle
  Rails.env.development? ? unmanifested_javascript_pack_tag("vendor-dll") : javascript_pack_tag("vendor") 
end

# layouts/appplication.html.slim
= vendor_bundle

@justin808
Copy link
Member

@robwise

  1. Should we put this logic in a PR?
  2. Would it make sense if we could use a naming convention so that - is used for the dll version:
javascript_pack_tag("vendor", dll: true)

Or maybe make a new helper

dll_pack_tag("vendor")

and that can use the

unmanifested_pack_tag("vendor")

@robwise
Copy link

robwise commented Jun 26, 2017

  1. IMO no, I think it's such a specific problem to have and there may be other uses that we're not anticipating that we should just expose this tag and then people can be free to employ it however they want
  2. The DLL thing may just be one use of this (I'm not sure if there are others or not), and not everyone is necessarily going to want to append -dll to the bundle name. That's just an internal convention we arbitrarily chose for our project. I would KISS, there's a helper that looks up in the manifest, there's a helper that doesn't. That way it's really easy to understand?

@justin808
Copy link
Member

@robwise @gauravtiwari, given this issue, how can we have webpacker support the DLL?

@robwise, if @gauravtiwari does not think this should get merged, should this be a separate gem or part of React on Rails. It seems very generic, so it does not make sense to put this in React on Rails.

@gauravtiwari
Copy link
Contributor

@justin808 DLL is nice but the setup is non-trivial and use case is pretty specific. Another gem sounds like a great idea or may be we can just document it in the README.

@robwise
Copy link

robwise commented Jun 29, 2017

Another gem to do what? All I want to do is use a helper to access the public webpacker directory without doing the manifest lookup. That's it. Nothing specifically to do with DLL, it's just an example of why someone might want to use it. Considering the extremely trivial code it takes to make this work, it's a no-brainer!

@gauravtiwari
Copy link
Contributor

Well, it was just an idea but the addition is pretty confusing (and name too). I understand that this might make sense for your particular use case but probably not for other people who are either just getting started or have small to medium projects to work with. Sure, because you know it 😄

Perhaps, this may be simpler:

javascript_pack_tag("vendor", manifest: false)

@robwise
Copy link

robwise commented Jun 29, 2017

That API would be fine with me too, as long as we have the ability to do this one way or another I'm happy lol

@iJackUA
Copy link
Author

iJackUA commented Jun 29, 2017

I don't mind to have an option or 2 tag helpers. But I still doubt does it ever makes sense to request Manifest for HMR via webpack-server? It still seem to me as two slightly different usecases: drop manifest for HMR and having ability to call explicit unmanifested asset helper.

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

5 participants