Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Adding helper function for setting webpack public path. #13

Merged
merged 1 commit into from
Jul 25, 2019

Conversation

joeldenning
Copy link
Collaborator

@joeldenning joeldenning commented Jul 15, 2019

Webpack public path is the configuration that allows ESM modules to have multiple code splits within that module that are loaded from the correct URL. The code splits are not in-browser modules themselves, but just a bundling/webpack concept that SystemJS and import maps are not involved in. There are two ways to configure the public path -- build time and on the fly (in the browser). It is nice for us to be able to do it on the fly because then we don't have to enforce any particular URL for where the bundles are going to be hosted in all of the various distributions.

In order to set the webpack public path on the fly, we need to ask SystemJS what the URL is for the module in the import map. Unfortunately, SystemJS does not have a way of doing that in a synchronous way. The asynchronous way doesn't work for us because code splits often begin downloading immediately upon synchronous execution of the webpack bundle. See discussion here for more details on that. So what this PR does is put in place a workaround for that missing feature in SystemJS. If SystemJS ever has the functionality available to us,

@angshu
Copy link
Member

angshu commented Jul 25, 2019

Ok with this. However, we should find a way to keep track of such customization, and to resolve in future whenever such PRs are merged or changed.

@joeldenning joeldenning merged commit a6d333f into master Jul 25, 2019
@joeldenning joeldenning deleted the public-path branch July 25, 2019 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants