Deprecated API usage: No "GlobalWorkerOptions.workerSrc" specified.
azalyeadev opened this issue · 2 comments
azalyeadev commented
I'm getting this error after updating the package:
GET http://localhost:8080/7.worker.js net::ERR_ABORTED 404 (Not Found)
Uncaught (in promise) Error: Setting up fake worker failed: "Cannot load script at: http://localhost:8080/7.worker.js".
vaidd4 commented
This comment on the related PDF.js issue might be useful
mozilla/pdf.js#10478 (comment)
arkokoley commented
@wbazalea
Assuming you are using webpack to build your vue system:
add worker-loader
npm i --save worker-loader
Add this to your webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
options: {
filename: '7.worker.js'
}
}
},
...
]
}
And add this to App.vue
/ main.js
/* eslint-disable */
var pdfwoker = require('worker-loader!pdfjs-dist/build/pdf.worker')
/* eslint-enable */