pbeshai / tidy

Tidy up your data with JavaScript, inspired by dplyr and the tidyverse
https://pbeshai.github.io/tidy
MIT License
725 stars 21 forks source link

Clarity on dependencies? #18

Closed geotheory closed 3 years ago

geotheory commented 3 years ago

I'm building a static app (no Node) and planned to run a local version of tidy.min.js (plus its d3 dependency), so I cloned the file at <script src="https://www.unpkg.com/@tidyjs/tidy/dist/umd/tidy.min.js"></script> and call locally. But encountered the error:

DevTools failed to load SourceMap: Could not load content for http://localhost:8888/js/tidy.min.js.map: 
HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

And it turns out there is a file at https://www.unpkg.com/@tidyjs/tidy@2.0.5/dist/umd/tidy.min.js.map which specifies a number of .ts files e.g:

image

Is tidy.min.js.map an actual dependency? I'm not a javascript dev by background so may be breaking some best practice by cloning as I have.

pbeshai commented 3 years ago

That error is just trying to load a source map to the originally code (which is written in typescript), so you can ignore it. I'm not sure if there's a better way to bundle it to not have those errors when used in the way you're using it but the .map file is totally optional and is only there to help debug code. It isn't an actual dependency for using tidy, it is just specified as a comment at the end to help debuggers:

 //# sourceMappingURL=tidy.min.js.map 

You can just delete that last line in your local file and it'll go away without issues. Nevermind, you're using unpkg... in this case I'd say you can just ignore it. Perhaps it should be published without the source map in the UMD version to avoid this issue

geotheory commented 3 years ago

Cool thanks for the tip :)