From c6a68c7095b406ef8212ed92bcfc8bc8f0c1270d Mon Sep 17 00:00:00 2001 From: Fabian Ehrentraud Date: Wed, 12 Jun 2019 08:36:44 +0200 Subject: [PATCH] feat: added option "prefixPublicPathWithWebpackPublicPath" when the option is active, and a publicPath is set, it will prefix the provided publicPath with the dynamic __webpack_public_path__ --- src/index.js | 4 ++++ src/options.json | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/index.js b/src/index.js index 4acfa15..f3248e9 100644 --- a/src/index.js +++ b/src/index.js @@ -42,6 +42,10 @@ export default function loader(content) { } publicPath = JSON.stringify(publicPath); + + if (options.prefixPublicPathWithWebpackPublicPath) { + publicPath = `__webpack_public_path__ + ${publicPath}`; + } } if (typeof options.emitFile === 'undefined' || options.emitFile) { diff --git a/src/options.json b/src/options.json index 546e22b..4159da6 100644 --- a/src/options.json +++ b/src/options.json @@ -31,6 +31,9 @@ } ] }, + "prefixPublicPathWithWebpackPublicPath": { + "type": "boolean" + }, "context": { "type": "string" },