perf: reduce tesseract bundle size by directly importing createWorker (#1979)

This commit is contained in:
Nolan Lawson 2021-03-06 09:07:06 -08:00 committed by GitHub
parent a2dcbcdcda
commit f22b1bf328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -4,7 +4,7 @@
// We should explore this at a later date. // We should explore this at a later date.
import corePath from 'tesseract.js-core/tesseract-core.wasm.js' import corePath from 'tesseract.js-core/tesseract-core.wasm.js'
import workerPath from 'tesseract.js/dist/worker.min.js' import workerPath from 'tesseract.js/dist/worker.min.js'
import { createWorker } from 'tesseract.js' import createWorker from 'tesseract.js/src/createWorker.js'
const { origin } = location const { origin } = location

View file

@ -15,7 +15,8 @@ const NOOP_MODULES = [
'tesseract.js/dist/worker.min.js.map', 'tesseract.js/dist/worker.min.js.map',
'tesseract.js-core/tesseract-core.wasm', 'tesseract.js-core/tesseract-core.wasm',
'tesseract.js-core/tesseract-core.wasm.js', 'tesseract.js-core/tesseract-core.wasm.js',
'tesseract.js' 'tesseract.js/src/createWorker.js',
'tesseract.js/src/createWorker.js.map'
] ]
const serverResolve = JSON.parse(JSON.stringify(resolve)) const serverResolve = JSON.parse(JSON.stringify(resolve))