-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Manifest includes assets_url in v4.0.0.rc.2 #1845
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
Comments
Thanks for reporting, let me take a look 👍 |
@gauravtiwari If this is not a bug, can you please explain why this happens, and can this will be fixed by any config parameter? |
@gauravtiwari I think this is breaking stuff for our users. Just adding update: From the Heroku docs:
Considering that our staging setup has a separate CDN url, this means that staging's CDN url is now baked in to the asset manifest file. I noticed there might ways of dealing with this by adding extra steps to the Procfile, but this is a bit of a hassle and I'd rather have that this type of default workflow would just work out of the box like the 3.x version of Webpacker. |
Extremely unhelpful, and not in the spirit of open source at all :( |
Please take a look to #1973 |
Sorry about not adding more info earlier. I was away :) Basically, this is not a bug, in other words, it sort of like chicken-egg situation. Rails add CDN host through helper tags for all the assets included in the views, however, assets like images or font icons which are included inside JS code or CSS files don't have CDN if we don't supply full public path since it's processed by file loader, which uses webpack public path. For example: import Rails from 'rails'
import Rails2 from 'rails_assets'
import Google from 'some_namespace/google'
const Hello = props => (
<div>Hello {props.name}!<img src={Google} /> <img src={Rails} /> <img src={Rails2} /></div>
) Note: The images included above won't have CDN included since they are processed by webpack using file loader, unless we specify public path with CDN. Now, current implementation works for both cases, since Rails is intelligent enough to figure out that a URI includes CDN host if we supply a CDN host to webpack and the generated URI includes CDN host, Rails doesn't add CDN host to it and the embedded assets also include CDN hosts. I see, this might not be ideal for some cases like described above but this is the best we can get at the moment that's why I added won't fix label earlier. If anyone has ideas, feel free to post. |
Found a solution :) |
Please see the PR |
Great! thanks for taking a look 🙂 |
Hello
In version
v4.0.0.rc.2
now generates a manifest.json file that includes the configured asset hostIn my production.rb I got
And my environment.js has
In version
v4.0.0.pre.3
the same settings would generate the manifest as followed:I do want to turn this off, since I do not know during compilation of my assets the cloudfront url and my devops team might want to change the cloudfront url. This would now mean we have to recompile assets again.
We compile assets and upload them to S3 using
env RAILS_ENV=production env NODE_ENV=production bundle exec rake webpacker:compile
Regards
The text was updated successfully, but these errors were encountered: