diff --git a/webpack/webpack.aot.js b/webpack/webpack.aot.js index 15b1f95e5e5e1b658e16caf3361cf30b2161bda5..75cb504e183e0064768494a5865e513c7cae9a7d 100644 --- a/webpack/webpack.aot.js +++ b/webpack/webpack.aot.js @@ -21,7 +21,7 @@ module.exports = merge(staticAssets, { module: { rules: [ { - test : /third_party.*?\.js$|worker\.js/, + test : /third_party.*?\.js$|worker\.js|worker-\w+\.js/, use : { loader : 'file-loader', options: { diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index a84b8489c97ef4b52e9350d7bf04f1643f22ae55..dee98b82a493c5700f0c663cb46e7f2c08547824 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -11,6 +11,7 @@ module.exports = { }, { test : /third_party|.*?worker.*?\.js$/, + exclude: /[Ss]pec\.js$/, use : { loader : 'file-loader', options: { diff --git a/webpack/webpack.dev-aot.js b/webpack/webpack.dev-aot.js index ca332572fe1a3347891d966cd05052ec5949987f..8adcad909ccbb08a9535246ab0c9b716b25966d2 100644 --- a/webpack/webpack.dev-aot.js +++ b/webpack/webpack.dev-aot.js @@ -22,7 +22,7 @@ module.exports = merge(staticAssets, { module: { rules: [ { - test : /third_party.*?\.js$|worker\.js/, + test : /third_party.*?\.js$|worker\.js|worker-\w+\.js/, use : { loader : 'file-loader', options: { diff --git a/src/util/worker.js b/worker/worker.js similarity index 98% rename from src/util/worker.js rename to worker/worker.js index e15e0313e12e97a28c56b1a12a05b1f047a399fc..973d7831c74163a6e21b99f567a05c1e0873bf5c 100644 --- a/src/util/worker.js +++ b/worker/worker.js @@ -1,3 +1,5 @@ +self.importScripts('./worker-second.js') + const validTypes = [ 'GET_LANDMARKS_VTK', 'GET_USERLANDMARKS_VTK', @@ -462,6 +464,14 @@ const getPerpendicularPointsForLine = (A, B, scale) => { let plotyVtkUrl onmessage = (message) => { + + if (message.data.method === 'ping') { + return postMessage({ + id: message.data.id, + result: `pong ${self.meaningOfLife}` + }) + } + if (message.data.method && VALID_METHODS.indexOf(message.data.method) >= 0) { const { id } = message.data if (message.data.method === VALID_METHOD.PROCESS_PLOTLY) {