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

Source map points to nonexisting src/ folder in npm package #219

Open
anderskiaer opened this issue Aug 4, 2022 · 1 comment
Open

Source map points to nonexisting src/ folder in npm package #219

anderskiaer opened this issue Aug 4, 2022 · 1 comment

Comments

@anderskiaer
Copy link

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
Copy link
Member

yGuy commented Aug 5, 2022

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?

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

Successfully merging a pull request may close this issue.

2 participants