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

Allow the public path to be set for Webpack chunk loading #182

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

paul121
Copy link
Member

@paul121 paul121 commented Sep 26, 2022

This is a prerequisite for fixing this farmOS core issue where farmOS-map chunks are not loaded for maps rendered via AJAX: https://www.drupal.org/project/farm/issues/3243922

The trick is that we need to set __webpack_public_path__ in the farmOS-map entrypoint main.js: https://stackoverflow.com/a/51245153. I chose to add this in a separate publicPath.js file as recommended by the Webpack On the fly docs (see warning message). This change works when simply added to the top of main.js but it raises eslint errors so a separate import makes this cleaner as well.

Added a quick note about this to the "Advanced integrations" section of the README, I'm not sure if we need to include additional details there?

@paul121 paul121 changed the title Allow the public path to be set for Webpack chunk loading. Allow the public path to be set for Webpack chunk loading Sep 26, 2022
@paul121
Copy link
Member Author

paul121 commented Sep 26, 2022

I've opened a merge request that implements this change for farmOS core: https://git.drupalcode.org/project/farm/-/merge_requests/73

But I think it is worth noting that this change could be useful for other projects that use farmOS-map in another framework where they are not bundling farmOS-map themselves.

@mstenta
Copy link
Member

mstenta commented Sep 27, 2022

I think this makes sense to me, and the changes look relatively simple. I'll defer the final decision to @symbioquine though since he has a better understanding of the considerations than I do.

@symbioquine symbioquine merged commit eedd137 into farmOS:2.x Sep 28, 2022
@paul121 paul121 deleted the 2.x-public-path branch September 28, 2022 17:04
@paul121
Copy link
Member Author

paul121 commented Sep 28, 2022

Thanks @symbioquine and also thank you @Vital-Agronomics for funding my time on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants