3 ms·
What is the benefit of importing a dependency only as devDependency and including it like this in the build? Why not just declare a normal dependency?
by fgeiger 4y ago
What is the benefit of importing a dependency only as devDependency and including it like this in the build? Why not just declare a normal dependency?
- chii 4y agopresumably, declaring it this way means you don't ever distribute pdfjs but expect it to be available in the runtime. Not sure if this was the goal.
- leodriesch 4y agoIt seems to me that they are using Rollup to bundle the PDF.js source code into their own. I’d guess it makes sense for PDF.js since you likely won’t need it outside of this library in your own project and it comes with multiple builds, of which they might choose one specific. Then install speeds are faster and node_modules are smaller.
- fgeiger 4y agoThanks for the explanation.
- jefozabuss 4y agoDevDependencies are not installed when you use —production flag at npm install (saving space and time here when you include this package) they are only used for releasing the package versions in this case I assume.
- fgeiger 4y agoYes, I understand the general use of dev dependencies. However, in this case, 'pdfjs-dist' must be in the build output anyway. So, what is the benefit of including it indirectly?