SimonDegraeve / hapi-webpack-plugin

Webpack middleware for Hapi. Supports HMR.
57 stars 25 forks source link

Respecting vhost option at plugin registration. {options: {routes: {vhost: ''}} #13

Open mashaalmemon opened 7 years ago

mashaalmemon commented 7 years ago

Hi @SimonDegraeve,

Thanks for accepting my pull request for Webpack 2.

I have a use case where my app has different applications (admin area, client area, etc.) which are each separate webpack bundles themselves. Each of these applications actually are served up in my setup on different vhosts (http://admin.mydomain.com, http:, client.mydomain.com) etc. The way the plugin is incorporated into the hapi framwork it doesn't allow this.

However when registering a plugin via server register, options.routes.vhost is an option that can be set as per the hapi API. I'd like to have the plugin respect this option when passed in and only execute the plugin for requests to the vhost vs to any request (which is what happens now)

I am soon to submit another pull request into the codebase that allows one to take advantage of vhosts for the plugin, and have multiple hapi-webpack-plugin's running, each one serving up a unique webpack bundle on a different vhost.

Note, i'm working to ensure it isn't a breaking revision; that is, if the vhost option is not set, it will behave just as it did before. Hopefully you'll be able to accept that pull request into the codebase as well.

I shall reference this issue within the pull request when it's ready.