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

Feature request: allow setting webpack's __webpack_public_path__ #1796

Open
raycohen opened this issue Feb 9, 2024 · 0 comments
Open

Feature request: allow setting webpack's __webpack_public_path__ #1796

raycohen opened this issue Feb 9, 2024 · 0 comments

Comments

@raycohen
Copy link
Contributor

raycohen commented Feb 9, 2024

Webpack has a feature that allows deciding at runtime what host to use for loading build files.

The API to do it is a bit odd and requires setting a seemingly magic variable (__webpack_public_path__) at the very beginning of your entry point file. Since embroider controls the entry point file handed to webpack behind the scenes, there's currently no way to accomplish this.

In practice, this feature allows you to do something like

__webpack_public_path__ = document.querySelector('meta[name="cdnHostName"]').content;

and now your server can control what CDN is used at runtime by including that meta tag in the html.

In my case I am uploading the same build assets to multiple CDNs and would like the ability to dynamically decide between them. My ember build takes ~30 minutes in CI so running the build multiple times just to be able to switch CDN is not feasible for me.

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

1 participant