fix: avoid using worker in file protocol

This commit is contained in:
Emmm Monster 2021-07-01 01:29:04 +08:00
parent 39c7294996
commit 8fdda048f6
No known key found for this signature in database
GPG Key ID: C98279C83FB50DB9

View File

@ -63,7 +63,7 @@ export default {
}
},
mounted() {
if (window.Worker && process.env.NODE_ENV === 'production') {
if (window.Worker && window.location.protocol !== "file:" && process.env.NODE_ENV === 'production') {
console.log("Using Worker Pool")
this.queue = Pool(
() => spawn(new Worker('@/utils/worker.ts')),