سؤال

I am using Worklight 6.1.0.1. I created a new workspace and created a new dojo app (no changes to the created Hello Worklight app). When I run the app in the preview mode in Safari, I get 5 errors in the browser console telling me that it failed to load several dojo javascript classes:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (favicon.png, line 0)

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (deviceTheme.js.map, line 0)

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (core-web-layer.js.map, line 0)

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (dojo.js.map, line 0)

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (mobile-ui-layer.js.map, line 0)

The Dojo Library Requests view shows requests for layers/core-web-layer.js.map, dojo/dojo.js.map and layers/mobile-ui-layer.js.map. Copying these to the project does not help.

Why does it ask for -.js.map resources? I haven't seen this notion and google returns no decent results on that.

هل كانت مفيدة؟

المحلول

The first error is pretty simple... in the HEAD of the HTML file there is a <link> declaration for a favicon.png, but the favicon.png does not exist in the common\images folder; this is actually OK, as a new Worklight application is not bundled with this image by deafult. Also, this image is more relevant for the Mobile Web and/or Desktop browser page environments and not to mobile environments. Either supply the image, or remove the declaration.

As for the Dojo .map file errors, I get them as well (for both common and Android environment) for: core-web-layer.js.map, mobile-ui-layer.js.map and dojo.js.map, but not for deviceTheme.js.map). However, the app still loaded properly, so at this time I will say this is harmless.

That said, I will open an internal defect to verify this issue.

نصائح أخرى

As Idan said, the app will load properly without these .map files. The .map files are Source Maps. They are a convention that provides a way for your debugger to map a minified javascript file to the original source file. So when you look at the JavaScript code in the debugger of your browser's developer tools, you end up seeing the full source even though it's executing the compressed version.

The Dojo that is included with your application has been minified for performance. As part of that process the reference to the .map file is appended to each of those minified javascript files. When the developer tools encounter this comment at the end of the file saying where to find the source map, it makes the request for the file. So it's your developer tools making the request that causes the 404. These map files and the full source, however, don't seem to be a part of the Dojo library.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top