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

Allow hosting from different base url / homepage #254

Closed

Comments

@MrHen
Copy link

@MrHen MrHen commented Apr 4, 2019

Issue description

I need a way to prepend a specific url to both the root location and viewer.js. I am hosting the bundle viewer through a docker container and am running nginx to route various urls into the servers.

As best as I can tell, one of the the following changes would give me a way to do what I want:

Technical info

  • Webpack Bundle Analyzer version: webpack-bundle-analyzer@3.1.0
  • Webpack version:
+-- react-scripts@2.1.8 
| `-- webpack@4.28.3 
  • Node.js version: v8.15.0
  • npm/yarn version: npm 6.4.1
  • OS: Docker

Debug info

CLI command:
react-scripts build --stats && webpack-bundle-analyzer build/bundle-stats.json -m server -O --port 8888 --host 0.0.0.0

nginx configuration:

upstream analyzer {
    server reporting-2-analyzer:8888;
}

server {
    # ...
    location /analyzer {
        proxy_pass http://analyzer;
    }

    # webpack-bundle-analyzer does not support a base url
    location /viewer.js {
        proxy_pass http://analyzer;
    }
@th0r
Copy link
Collaborator

@th0r th0r commented Apr 10, 2019

@MrHen will usage of the relative url for viewer.js help? E.g.

<script src="viewer.js"></script>

@MrHen
Copy link
Author

@MrHen MrHen commented Apr 10, 2019

@th0r Yeah, that would probably work.

@MrHen
Copy link
Author

@MrHen MrHen commented Apr 11, 2019

I confirmed the fix on my end. Thanks @th0r !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment