-
Notifications
You must be signed in to change notification settings - Fork 48
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
anyway to define __webpack_public_path__ or cdn? #160
Comments
The only supported way is through Webpack |
do you have any suggestions how to work with docker and cdn with multiple envs? since CDN will be used only for production, so that means that we need to create docker image with and without cdn if there's no any other way.. |
I didn't work with Docker so I'm not an expert on it. |
@idangozlan I'm facing the same issue. What I ended up doing is, I created a file with the setting of That takes care of the client. For the server, I had to look for an env variable I use for overwritting the cdn path and doing a replace on the assets paths. I tried adding the same script from above to the server side entry point with no luck. Where you able to solve this? |
@jarzuaga |
@catamphetamine The problem I'm trying to solve is being able to build the application once and deploy it to different environments with different CDN paths. You can't use I'm setting that variable on my entry points on the client side and that's working fine. However, on the server side, I couldn't find where to do this. I tried the server's entry point but all I get is a type error about |
@jarzuaga The assets source from webpack stats has shape: module.exports = __webpack_public_path__ + \"9059f094ddb49c2b0fa6a254a6ebf2ad.jpg\"
webpack-isomorphic-tools/source/plugin/write assets.js Lines 167 to 169 in 59aa50f
webpack-isomorphic-tools/source/plugin/plugin.js Lines 190 to 193 in 59aa50f
So, basically,
From: module.exports = __webpack_public_path__ + \"9059f094ddb49c2b0fa6a254a6ebf2ad.jpg\" To: var __webpack_public_path__ = '...'
module.exports = __webpack_public_path__ + \"9059f094ddb49c2b0fa6a254a6ebf2ad.jpg\" And in "https://.../9059f094ddb49c2b0fa6a254a6ebf2ad.jpg" If you want module.exports = "__webpack_public_path__ + \"9059f094ddb49c2b0fa6a254a6ebf2ad.jpg\"" If this gets compiled then it would return: __webpack_public_path__ + "9059f094ddb49c2b0fa6a254a6ebf2ad.jpg" And then, when the application So, in short: the current handling of assets replaces |
Gotcha. Would you know if this something that could be accomplished in an "easier" way in |
I guess |
I see. I'm going to try it on that other application with |
@jarzuaga do you have any insights :)? |
On |
yeah. I guess our all problem is the SSR and not the client.. anyway, if you have any PR for that, please share it with us in here :) |
@jarzuaga I had a similar thought: as a hacky workaround one could write a basic Node.js script taking path to a file and replacing all CDN_URL substrings in it with a custom CDN URL and then running Example:
|
Hi,
Is there anyway to define CDN url by variable and not trough the webpack build process?
Thanks.
The text was updated successfully, but these errors were encountered: