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

Manifest file includes asset host #3005

Closed
willcosgrove opened this issue May 3, 2021 · 1 comment
Closed

Manifest file includes asset host #3005

willcosgrove opened this issue May 3, 2021 · 1 comment

Comments

@willcosgrove
Copy link

Hi, we're using this in a Rails application that is deployed on Heroku using their Pipeline feature. After upgrading to the latest beta, I noticed that the manifest file that is generated includes the asset host configured for the application.

The issue we're having with this is that the asset host is different between application stages (staging uses one CDN, production uses another). So if I take a build of the application meant for staging, and try to directly promote it to master, it will be using the wrong CDN. Before upgrading, we were able to promote without having this issue.

My understanding of why this is needed is so that if you're doing some kind of code splitting where JS files are lazy loaded, the compiled JS files need to know where to grab the other split files from. Our JS files are split now after performing this upgrade to Webpacker 6, but they appear to all be eager loaded in the HTML by the javascript_pack_tag helper.

I realize that depending on your setup, to some this is a feature and not a bug. But because we are not lazy loading JS files from JS, this ends up causing more problems than it fixes. Is there a way to disable this functionality if we don't need it?

Thank you!

@willcosgrove
Copy link
Author

I think I've achieved the desired effect by setting the WEBPACKER_ASSET_HOST ENV variable to an empty string.

I tried that before I posted but it didn't work. I realized later that the JS hadn't rebuilt because no JS changes had happened, so it didn't rebuild the manifest file with the new ENV variable present. Once I forced the JS to rebuilt, the manifest was built without the CDN host.

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