-
Has anyone solved this using Webpack 5 and Yarn (Berry)? With the way yarn stores dependencies in zip files, none of these solutions make a lot of sense for me. Plus, I don't understand where the references to Even if i manually installed that dependency, the solutions I've seen would not work as the imports or references to things like Am I missing something here? Why should I even be concerned about where this worker file lives? Originally posted by @forgo in #97 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
By itself, Yarn Berry shouldn't be a problem - you can always use The trick is to So, instead of:
|
Beta Was this translation helpful? Give feedback.
By itself, Yarn Berry shouldn't be a problem - you can always use
nodeLinker: node-modules
to make it completely backwards compatible. However, PnP creates issues with direct references tonode_modules
directory, because there isn't one.The trick is to
require.resolve
pdfjs-dist
'spackage.json
- this will give us an easy access topdfjs-dist
virtual folder. This will also work with old node_modules system, so that's actually the recommended way.So, instead of:
node_modules/pdfjs-dist
, usepath.dirname(require.resolve('pdfjs-dist/package.json'))
.pdf.worker.js
CopyWebpackPlugin
You can use
CopyWebpackPlugin
to copypdf.worker.js
. However,CopyWebpackPlugin
will not accept'node_modules/b…