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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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,