Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated API usage: No "GlobalWorkerOptions.workerSrc" specified. #78

Closed
azalyeadev opened this issue Oct 20, 2020 · 2 comments
Closed

Comments

@azalyeadev
Copy link

azalyeadev commented Oct 20, 2020

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".

@arkokoley

@vaidd4
Copy link

vaidd4 commented Oct 25, 2020

This comment on the related PDF.js issue might be useful
mozilla/pdf.js#10478 (comment)

@arkokoley
Copy link
Owner

arkokoley commented Oct 29, 2020

@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 */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants