From 22823ca9985ce1292d3b1c37adb207e34a090581 Mon Sep 17 00:00:00 2001 From: "cinwell.li" Date: Wed, 12 Sep 2018 14:13:52 +0800 Subject: [PATCH 1/2] feat: add publicPath options See https://github.com/webpack-contrib/worker-loader/#publicpath --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 1032cd5..9d9848a 100644 --- a/src/index.js +++ b/src/index.js @@ -114,6 +114,9 @@ loader.pitch = function(request) { if (options.inline) { worker.url = `URL.createObjectURL(new Blob([${JSON.stringify(contents)}]))`; } + else if (options.publicPath) { + worker.url = `${JSON.stringify(options.publicPath)} + ${JSON.stringify(worker.file)}`; + } else { worker.url = `__webpack_public_path__ + ${JSON.stringify(worker.file)}`; } From 4aa055975340b92eb8fb4c274b21a5bc89820dc6 Mon Sep 17 00:00:00 2001 From: "cinwell.li" Date: Thu, 15 Aug 2019 09:44:40 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-Authored-By: Jason Miller --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 9d9848a..48c17e8 100644 --- a/src/index.js +++ b/src/index.js @@ -115,7 +115,7 @@ loader.pitch = function(request) { worker.url = `URL.createObjectURL(new Blob([${JSON.stringify(contents)}]))`; } else if (options.publicPath) { - worker.url = `${JSON.stringify(options.publicPath)} + ${JSON.stringify(worker.file)}`; + worker.url = `${JSON.stringify(options.publicPath + worker.file)}`; } else { worker.url = `__webpack_public_path__ + ${JSON.stringify(worker.file)}`;