-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify asset proxy field to accept just host strings
- Loading branch information
Showing
2 changed files
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
// Set the default CDN or remote for fetching the assets; NPM shouldn't change this var. | ||
|
||
export const redefinePublicPath = (url) => { | ||
// There's no URL validation here, so caller should check arg if need be. | ||
__webpack_public_path__ = url // eslint-disable-line | ||
export const redefinePublicPath = (urlString) => { | ||
const isOrigin = urlString.startsWith('http') | ||
// Input is not expected to end in a slash, but webpack concats as-is, so one is inserted. | ||
urlString += '/' | ||
// If there's no existing HTTP scheme, the secure protocol is prepended by default. | ||
__webpack_public_path__ = isOrigin ? urlString : 'https://' + urlString // eslint-disable-line | ||
} |