nikushi / minipack

Minipack, a gem for minimalists, which can integrates Rails with webpack. It is an alternative to Webpacker.
MIT License
115 stars 22 forks source link

Packs are requested from invalid url #29

Closed sadgb closed 4 years ago

sadgb commented 4 years ago

Hello. I am using webpack-dev-server on port 9000 and rails server on port 3000 However for some strange reason rails generates paths like http://localhost:3000/packs/landing-95e755f46be9e49e5bfc.js but should http://localhost:9000/packs/landing-95e755f46be9e49e5bfc.js

I am porting my application from webpack and done step by step instructions however this port mismatch makes me crazy. Could you please point me in the right direction ?

nikushi commented 4 years ago

Helpers provided by minipack construct paths based on the base url served by Rails. So the behavior you reported is as expected.

To integrate Rails with webpack dev server, there is a way to use Rack::Proxy, then proxies requests for assets from your rails app to a backend webpack dev server e.g. https://gist.github.com/nikushi/4447f11f12b24db50b42608feeb848e2.

nikushi commented 4 years ago

Let me close the issue because it is an expected behavior. Yet, we can still continue communication on the issue.

sadgb commented 4 years ago

Thank you very much. I still have some issues, but packs are served correctly now.

nikushi commented 4 years ago

Good to hear that. You can share your remaining issues. I may help you.

sadgb commented 4 years ago

I found few issues on our side, not related to your awesome repo. Everything works like a charm now