From c98b96aa446fbd070f0a493f806b16640637f9a6 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 18 Aug 2019 15:15:20 -0700 Subject: [PATCH] fix: move worker-loader to webpack config (#1405) This avoids ESLint complaining about the `worker-loader!` declaration --- src/routes/_utils/blurhash.js | 2 +- webpack/client.config.js | 6 ++++++ webpack/server.config.js | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/routes/_utils/blurhash.js b/src/routes/_utils/blurhash.js index 9534c72d..12296765 100644 --- a/src/routes/_utils/blurhash.js +++ b/src/routes/_utils/blurhash.js @@ -1,4 +1,4 @@ -import BlurhashWorker from 'worker-loader!../_workers/blurhash' // eslint-disable-line +import BlurhashWorker from '../_workers/blurhash' import PromiseWorker from 'promise-worker' import { BLURHASH_RESOLUTION as RESOLUTION } from '../_static/blurhash' import { QuickLRU } from '../_thirdparty/quick-lru/quick-lru' diff --git a/webpack/client.config.js b/webpack/client.config.js index da57207c..1dc3709a 100644 --- a/webpack/client.config.js +++ b/webpack/client.config.js @@ -35,6 +35,12 @@ module.exports = { } } }, + { + test: /\/_workers\/blurhash\.js$/, + use: { + loader: 'worker-loader' + } + }, { test: /\.m?js$/, include: /node_modules\/emoji-mart/, diff --git a/webpack/server.config.js b/webpack/server.config.js index 7a529d78..31da5942 100644 --- a/webpack/server.config.js +++ b/webpack/server.config.js @@ -5,6 +5,7 @@ const { mode, dev, resolve, inlineSvgs } = require('./shared.config') const serverResolve = JSON.parse(JSON.stringify(resolve)) serverResolve.alias['page-lifecycle/dist/lifecycle.mjs'] = 'lodash-es/noop' // page lifecycle fails in Node +serverResolve.alias['../_workers/blurhash'] = 'lodash-es/noop' // not used on the server side module.exports = { entry: config.server.entry(),