Absolute path for worker.js
See original GitHub issueWhile the pdf viewer works well in local, I have an issue when building my application and serving it over IIS via an Asp.Net application. For some reason it tries to retrieve worker.js as an absolute path (/
) while it should be relative : it tries to retrieve http://server-name/hash.worker.js
instead of http://server-name/application-name/hash.worker.js
/3bc5b590ef81019703f0.worker.js
Failed to load resource: the server responded with a status of 404 (Not Found)
Note : when building I get this structure :
wwwroot
| - [hash].worker.js
| - static
| - js
| - 0.[hash].js
| - app.[hash].js
| - manifest.[hash].js
| - vendor.[hash].js
It seems like worker.js
is almost equivalent to 0.js
(almost the same size for the .js
, .js.gz
and .js.map
, just slighly lighter for the 0.js
files). But including it won’t change anything, it still doesn’t work.
EDIT : I guess this is a webpack issue, but I don’t understand why it is served under the “publicPath” repository and not the usual directory used by everything else. The actual question is : Why is worker.js generated under the public path rather than the dist path ? And why is it not integrated in the vendor.js bundle ?
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (4 by maintainers)
then try to hack this line: https://github.com/FranckFreiburger/vue-pdf/blob/fb274cbb81956d8c39f6febb67a2c11b72b1324d/src/vuePdfNoSss.vue#L13
I fixed it like this
import PdfjsWorker from 'pdfjs-dist/build/pdf.worker.js';
webpack.configmodule : { rules: [ { test: /\.worker\.js$/, use : { loader : 'worker-loader', options: {inline: true, fallback: false} }, } ] }