From 9174b6faa9ccaeedee3f2dc2e31d8f90ef9f28de Mon Sep 17 00:00:00 2001 From: Aki <75532970+AkiSakurai@users.noreply.github.com> Date: Wed, 1 Jun 2022 21:58:22 +0800 Subject: [PATCH] Fix the issue that revokeObjectURL becomes no-op workerUrl is template string to create object url. --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 9bb9a35..f357f62 100644 --- a/src/index.js +++ b/src/index.js @@ -182,8 +182,9 @@ loader.pitch = function(request) { var addMethods = require(${loaderUtils.stringifyRequest(this, path.resolve(__dirname, 'rpc-wrapper.js'))}) var methods = ${JSON.stringify(exports)} module.exports = function() { - var w = new Worker(${workerUrl}, { name: ${JSON.stringify(filename)} }) - URL.revokeObjectURL(${workerUrl}); + var url = ${workerUrl} + var w = new Worker(url, { name: ${JSON.stringify(filename)} }) + ${ options.inline ? 'URL.revokeObjectURL(url);' : '' } addMethods(w, methods) ${ options.ready ? 'w.ready = new Promise(function(r) { w.addEventListener("ready", function(){ r(w) }) })' : '' } return w