fix: move worker-loader to webpack config (#1405)

This avoids ESLint complaining about the `worker-loader!` declaration
This commit is contained in:
Nolan Lawson 2019-08-18 15:15:20 -07:00 committed by GitHub
parent 009a511c80
commit c98b96aa44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -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 PromiseWorker from 'promise-worker'
import { BLURHASH_RESOLUTION as RESOLUTION } from '../_static/blurhash' import { BLURHASH_RESOLUTION as RESOLUTION } from '../_static/blurhash'
import { QuickLRU } from '../_thirdparty/quick-lru/quick-lru' import { QuickLRU } from '../_thirdparty/quick-lru/quick-lru'

View file

@ -35,6 +35,12 @@ module.exports = {
} }
} }
}, },
{
test: /\/_workers\/blurhash\.js$/,
use: {
loader: 'worker-loader'
}
},
{ {
test: /\.m?js$/, test: /\.m?js$/,
include: /node_modules\/emoji-mart/, include: /node_modules\/emoji-mart/,

View file

@ -5,6 +5,7 @@ const { mode, dev, resolve, inlineSvgs } = require('./shared.config')
const serverResolve = JSON.parse(JSON.stringify(resolve)) const serverResolve = JSON.parse(JSON.stringify(resolve))
serverResolve.alias['page-lifecycle/dist/lifecycle.mjs'] = 'lodash-es/noop' // page lifecycle fails in Node 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 = { module.exports = {
entry: config.server.entry(), entry: config.server.entry(),