pearofducks / rollup-plugin-dev

development server for rollup with additional logging and options

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simulate multiple domains

ChristopherHButler opened this issue · comments

Hi,
I am trying to setup a dev environment for developing widgets. In the book Third Party JavaScript They describe how to simulate multiple domains by modifying your hosts file and configuring Apache web server to create two virtual hosts. I was wondering if something similar is possible using the rollup-plugin-dev development server. Basically I want to serve the widget IIFE code from one domain, say widget.dev and a test html file which loads the script code on another domain, say publisher.dev. The HTML page at publisher.dev would have a <script> tag which loads the widget. Is this something that con be configured?

If I'm understanding you correctly, you would like this plugin to serve both of your example domains?

That's outside the scope of this plugin - but if you had sub-paths for those two domains you could do it - e.g. widget.dev/foo and publisher.dev/bar.

Otherwise you would need to use a proxy server in front like Apache or Nginx to route domains to different upstream paths/hosts.