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

Invalid source map #153

Closed
benmccann opened this issue Apr 14, 2021 · 6 comments
Closed

Invalid source map #153

benmccann opened this issue Apr 14, 2021 · 6 comments
Assignees
Labels
bug Something isn't working released

Comments

@benmccann
Copy link

Bug report

Describe the bug

sources refers to a file that's not in the distribution

{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAG7C,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AAErC;;GAEG;AACH,MAAM,YAAY,GAAG,CACnB,WAAmB,EACnB,WAAmB,EACnB,OAA+B,EAC/B,EAAE;IACF,OAAO,IAAI,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AAC9D,CAAC,CAAA;AAED,OAAO,EACL,YAAY,EACZ,cAAc,GAKf,CAAA"}

To Reproduce

npm install --save @supabase/supabase-js
 cat node_modules/@supabase/supabase-js/dist/module/index.js.map 

Expected behavior

I'm not a source map expert, so I'm not quite sure the best way to fix this. I think you'd either want to distribute the source in the npm package or inline it to the sourcemap

Additional context

I don't use Supabase, but work on SvelteKit and users are reporting issues that seem to be caused by trying to load this file that doesn't exist. sveltejs/kit#673 (comment)

@awalias
Copy link
Member

awalias commented Apr 14, 2021

hey @benmccann thanks for the report! we'll take a look

@kiwicopple
Copy link
Member

kiwicopple commented Apr 14, 2021

Strange, it's just coming from the tsconfig

"sourceMap": true,

sourcemap option: https://www.typescriptlang.org/tsconfig#sourceMap

Seems like the path to the file is wrong?
image

@kiwicopple
Copy link
Member

kiwicopple commented Apr 14, 2021

It looks like I can fix this by setting mapRoot option in tsconfig to "mapRoot": "./",

This produced the file:

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC9E,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AAErC;;GAEG;AACH,QAAA,MAAM,YAAY,gBACH,MAAM,eACN,MAAM,gEAIpB,CAAA;AAED,OAAO,EACL,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,QAAQ,EACR,WAAW,GACZ,CAAA"}

Just need someone to test this output works with SvelteKit (i'll ask a member of our community)

edit: didn't work

Error: ENOENT: no such file or directory, open '/home/ixxie/repos/coflow-app/node_modules/@supabase/supabase-js/dist/module/index.ts'

It seems we really do need to ship all of the src folder to npm too so that the maps in the dist folder can resolve properly

image

@kiwicopple
Copy link
Member

🎉 This issue has been resolved in version 1.11.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kiwicopple
Copy link
Member

🎉 This issue has been resolved in version 1.11.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kiwicopple
Copy link
Member

kiwicopple commented Apr 14, 2021

OK this is now solved (i hear there's a problem with global declaration inside the websocket library, but we should start a new issue for that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

4 participants