-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
CDN assets not working since 3.2.0 #1186
Comments
@navied It should work if you configure Rails to use CDN. config.action_controller.asset_host = 'mycdnsubdomain.fictional-cdn.com' |
@gauravtiwari Yup! That is already set to the CDN url, all my JS assets within the manifest.json works fine with the proper CDN url attached it is only images that are being imported within my react component that are not being attached with a CDN url. |
Ahh right, will try to reproduce later and report back but in meantime you could try either: // config/webpack/environment.js
const fileLoader = environment.loaders.get('file')
fileLoader.use[0].options.publicPath = process.env.SOME_CDN // OR
// THIS SHOULD BE AT THE TOP BEFORE ALL IMPORTS/PACKS THAT USED IMAGES/FONTS
__webpack_public_path__ = process.env.SOME_CDN
// rest of your application entry |
Great! I was able to get it to work with 1 by doing this:
Are we able to access what is in config.action_controller.asset_host here? EDIT: I was able to make it less "static" by just bringing back some of the code that was removed from #1107 Came up with this:
It looks a bit messy but it does work, bringing back the old code in some form might end up being a better solution |
#1186 (comment) worked for us, maybe it would be a good thing to bring back some of the code as @navied suggested |
@gauravtiwari any update on this? Is there a work around for this or will I'll need to do something like #1186 (comment)? |
Please try the latest RC, otherwise feel free to open a new issue with more details. |
I am having issues with imported assets not being embedded with their proper CDN links since 3.2.0. The asset is being imported like this on top:
It shows up properly in dev but when pushing to staging the assets do not attach the proper CDN link associated with it. I also tried setting webpack_public_path on top of the file to the cdn root but to no luck.
I have tried using url-loader as well but it just ends up breaking the assets in dev as well.
I believe it is because of #1107 that is causing this issue now, is there something that I need to change to support CDN imports again in 3.2.0?
The text was updated successfully, but these errors were encountered: