yWorks/svg2pdf.js

Source map points to nonexisting `src/` folder in `npm` package

anderskiaer opened this issue · 1 comments

Describe the bug
Source map URLs are provided as comments in the dist bundles, but the src directory does not exist in the npm package, giving many warnings of type:

WARNING in ./node_modules/svg2pdf.js/dist/svg2pdf.es.min.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'node_modules/svg2pdf.js/src/nodes/geometrynode.ts' file: Error: ENOENT: no such file or directory, open 'node_modules/svg2pdf.js/src/nodes/geometrynode.ts'

To Reproduce
Steps to reproduce the behavior:

  1. npm install svg2pdf.js jspdf
  2. import 'svg2pdf.js'
  3. Use CRA or webpack to bundle and observe warnings at compilation time.

Expected behavior
Include src/ in npm package for the source map to work, or remove source map URL comments?

Additional context
As a workaround, we currently run this post install command to remove warnings from svg2pdf.js source maps, but still have source maps for other packages:

sed -i '/^\/\/# sourceMappingURL=/d' ./node_modules/svg2pdf.js/dist/*
yGuy commented

Thanks for the report and proposed fix!

Honestly, I am not so much in favor of increasing the npm bundle size, just to make debugging a tiny bit easier. If you really need to debug and don't develop the npm module, I think it should be OK to require downloading specific files from GitHub just for this purpose and not have everyone and every build job download a bundle that contains >60% just "dead code bytes".
So in a way, I would actually favor solution one where we get rid of the source map comments.

How do other libraries handle this? What do you think?