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 missing #92

Closed
ghost opened this issue Jan 5, 2020 · 8 comments
Closed

Source map missing #92

ghost opened this issue Jan 5, 2020 · 8 comments

Comments

@ghost
Copy link

ghost commented Jan 5, 2020

Hello everybody! :)

I am trying to use you nice color picker in a webpage that controls my LED Lantern.

I followed the instructions: https://github.com/jaames/iro.js

So far so good, the color picker appears as intended, I can move the slider and so on. However if I try to execute a function of event (exactly as in the example) the console says:

Source-Map-Fehler: Error: request failed with status 404
Ressourcen-Adresse: http:https://192.168.2.104/js/iro.min.js
Source-Map-Adresse: iro.min.js.map

Sorry, German browser, but it says: source map error, iro.min.js.map missing. Unfortunately I am not so deep into Java and I don't really know what a source map is, but I understand that the color picker tries to request a file from the server, that is not included in the download and does thus not exist...

Help! :)

Best regards
Daniel

@ghost
Copy link
Author

ghost commented Jan 5, 2020

Little update: I found the map file here on GitHub and copied it on my server folder. Now I get a new message:

Source-Map-Fehler: Error: JSON.parse: unexpected character at line 7 column 1 of the JSON data
Ressourcen-Adresse: http:https://192.168.2.104/js/iro.min.js
Source-Map-Adresse: iro.min.js.map

:-(

@jaames
Copy link
Owner

jaames commented Jan 5, 2020

The source map isn't important; it's just something that your browser's developer tools can use. It isn't even downloaded unless you open the developer tools.

Since iro.js.min is compressed and minified, a source map basically helps developers find the original line and file for a specific segment of code if an error occurs.

You can find more info about sourcemaps here: https://developers.google.com/web/tools/chrome-devtools/javascript/source-maps

If you want to use the sourcemap you can find it here: https://github.com/jaames/iro.js/blob/master/dist/iro.min.js.map

In the next release (5.0) I'll probably just remove sourcemaps altogether because they seem to trip more people up than help them

TL;DR don't worry about it, the warning can be ignored :)

@jaames jaames closed this as completed Jan 5, 2020
@ghost
Copy link
Author

ghost commented Jan 5, 2020

Oh ok, thanks for the quick reply! I
May I ask one more question: If I have a look at the iro.js file, there are tons of requests from the internet, such as google analytics, css etc. I would like to use the colorpicker in a local network without internet access. Does this work? At least the iro.min.js does not seem to fetch anything from the internet as far as I can see in Firefox network analysis. The code is just one long line, so a bit difficult to read :)

Best regards
Daniel

@jaames
Copy link
Owner

jaames commented Jan 5, 2020

@danielschlingmeier No worries :)

Er, which file are you looking at exactly? There shouldn't be any analytics, css, etc embedded into iro.js, and it certainly shouldn't be making any requests (besides the sourcemap like I mentioned). Everything it needs is included in a single JavaScript file, and that's done intentionally so that iro.js can operate without internet access like you're asking.

You can view the uncompressed build of iro.js if you'd like to confirm this yourself: https://github.com/jaames/iro.js/blob/master/dist/iro.js

If you're 100% certain those requests are originating from iro.js, you might be looking at a file with something else bundled into it, or you've downloaded something from a sketchy second-hand source that's added their own stuff into the file. Could you please double-check?

@ghost
Copy link
Author

ghost commented Jan 5, 2020

Example from iro.js:
function createNode(nodeName, isSvg) { var node = isSvg ? document.createElementNS('http:https://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName); node.normalizedNodeName = nodeName; return node; }

@jaames
Copy link
Owner

jaames commented Jan 5, 2020

That doesn't actually make a request; createElementNS() creates a HTML element with a specific namespace URI, and 'http:https://www.w3.org/2000/svg' is the namespace URL for an SVG element.

I'm not really sure why, but this is just how you create an SVG element in JavaScript.

@ghost
Copy link
Author

ghost commented Jan 5, 2020

Yes I know the feeling...not really sure, but this is how you do it! 💃

:-)

Anyway thanks a lot for you support. Nice colorpicker by the way, I like it :)

@jaames
Copy link
Owner

jaames commented Jan 5, 2020

Yeah, JavaScript is just kinda one of those languages, lol

No problem! Thank you for the kind words :)

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

No branches or pull requests

1 participant