IBM Worklight with Dojo Toolkit | dojo/main.js 404 not found issue - dojo

I have recently started exploring IBM Worklight which looks really promising to build hybrid mobile apps, in order to do so, created a Worklight project while choosing Dojo Toolkit as a default framework choice and got to see the missing dojo/main.js issue.
Here is the HTML code:
<!DOCTYPE HTML>
<html>
<head>
<title>TD_Mobile</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="dojo/dojo.js" data-dojo-config="isDebug: false, parseOnLoad: true, async: false"></script>
<link rel="stylesheet" href="css/TD_Mobile.css">
</head>
<body id="content" style="display: none;">
<div data-dojo-type="dojox.mobile.ScrollableView" id="view0"
data-dojo-props="selected:true"></div>
TD_Mobile
<!--application UI goes here-->
<script src="js/initOptions.js"></script>
<script src="js/TD_Mobile.js"></script>
<script src="js/messages.js"></script>
</body>
</html>
When I do build and deploy and run the project from worklight console as a common resource, got to see the main.js not found issue at the following path http://localhost:8080/apps/services/preview/TD_Mobile/common/1.0/default/dojo/main.js
And to my surprise further, I was able to search the reference folder at C:\Users\marif\workspace\WorklightServerHome\TD Mobile New\widget-resources\TD_Mobile-common-e6cd3d9088c88e96df743ed1c9a1b584a90da8c9\preview\default\dojo and don't see main.js and some more JS files there.
Looks like final deployed build somehow not working properly, would appreciate for any quick pointer.

Not all files are included in the dojo build, there is a file called build-dojo.xml in your project.
Add main.js to it.
Under <patternset id="dojo.resources.loose-modules"> add the modules you want to use.

This sounds like a write permissions issue.
Can you please create a new project and see if it happens there as well?
If it does not then the issue is solved, else it might be a plugin issue.
Do you get any error message is the Worklight console in the build process?

Related

How can I force client to not cache the svelte/rollup bundle.js?

My svelte rollup.js setup has an index.html file with this head:
<link rel='stylesheet' href='/build/bundle.css'><!-- svelte -->
<link rel="stylesheet" href="/build/index.css" /><!-- tailwind -->
<script defer src='/build/bundle.js'></script>
When I deploy a new version to my web server, some clients don't fetch the new bundle.js but instead use their cached copy. What's a good way of forcing them to fetch the new bundle when I've deployed a new version?
The simplest way I can think of would be to add the version number or git commit hash to the end of src, e.g:
<link rel='stylesheet' href='/build/bundle.css?v0.1.4'><!-- svelte -->
<link rel="stylesheet" href="/build/index.css?v0.1.4" /><!-- tailwind -->
<script defer src='/build/bundle.js?v0.1.4'></script>
But I assume this is a common problem, so I'd rather ask.
There's a section in the docs about using hash's in the bundle names. https://rollupjs.org/guide/en/#outputentryfilenames

WebStorm HTML files are showing TypeScript errors for HTML elements

I installed a fresh copy of WebStorm and opened up an existing Angular project.
When I open up any HTML file in the project the IDE shows 'Cannot find div' for all div tags in the .html file. For a few seconds the IDE is fine, then it shows a '2.5.3 Typescript' tab with a list of TypeScript errors.
Some Typescript tab errors:
Error:(1, 2) TS2304: Cannot find name 'div'.
Error:(3, 4) TS2304: Cannot find name 'div'.
Error:(3, 9) TS2304: Cannot find name 'ngIf'.
I've tried invalidating the cache and restarting. I've tried disabling TSLint. I've tried injecting language for some of the attributes/tags.
Even index.html throws a bunch of TypeScript errors.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="">
</head>
<body>
</body>
</html>
I expect no red squiggly marks in the .html file since it is all valid.
It works fine in VS Code.
Known issue, WEB-36373 is fixed in 2018.3.3.
For now, I can suggest turning Angular language service off in Settings | Languages & Frameworks | TypeScript (all the angular functionality will still be available)

Trouble displaying test results in browser with Mocha, Chai, and webdriver.io

I am using Webdriver.io with Mocha and Chai. I've written several tests that work great from the command line. It opens the Chrome browser, runs the tests, and displays the resultsin the command line. However I am having issues getting the results of the tests to display in the browser view (have a presentation that I would like to show the tests in the browser view). I'm using the mocha html template for viewing tests in the browser, but it only displays "passes: 0failures: 0duration: 0s" in the upper right. I've copied the html file to the first file in my testing structure and changed the paths to the js and css files. I don't see anything in here that references webdriver.io, is that the missing piece?
<!DOCTYPE html>
<html>
<head>
<title>Mocha</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="./node_modules/mocha/mocha.js"></script>
<script src="./node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd');</script>
<script src="./test/specs/createNewProduct.js"></script>
<script>
mocha.run();
</script>
</body>
</html>
I'm opening the file by right clicking on it and opening with Chrome.
Hi I am not clear understand what you want to achieve. But have look to https://github.com/webdriverio-boneyard/wdio-allure-reporter
It is generate beautiful reports for wdio

What does ERR_CONTENT_DECODING_FAILED

This is the error code I am getting. I am a novice at this and could really use some help. I happened to open the "developer" tool in Chrome and might have made a mistake or something because now I cannot see my slider or testimonials. Can anyone help? Sorry if my question is not posed correctly, I am having a panic attack and this is my first time using this form. The slider works fine in other browsers, just not Chrome -- all of a sudden.
GET https://fitkidsstage.com/wp-content/plugins/revslider/public/assets/css/settings.css?ver=5.1.6 net::ERR_CONTENT_DECODING_FAILED
jquery-migrate.min.js?ver=1.4.1:2 JQMIGRATE: Migrate is installed, version 1.4.1
(index):1078 GET https://fitkidsstage.com/wp-content/themes/kindergarten/js/main.js?ver=4.9.5 net::ERR_CONTENT_DECODING_FAILED
(index):1080 Uncaught SyntaxError: Unexpected token .
From here:
It happens when your HTTP request's headers claim that the content is gzip encoded, but it isn't. Turn off gzip encoding setting or make sure the content is in fact encoded.
This loads fine in Chrome (Version 65.0.3325.181 (Official Build) (64-bit)) though (exception running the script due to other missing dependencies), so your problem may be elsewhere.
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="
crossorigin="anonymous"></script>
<link rel="stylesheet" href=" https://fitkidsstage.com/wp-content/plugins/revslider/public/assets/css/settings.css?ver=5.1.6">
<script src="https://fitkidsstage.com/wp-content/themes/kindergarten/js/main.js?ver=4.9.5 "></script>
<body>
<div>
Hi
</div>
</body>

ELM : Compile ELM page to JS

after creating an ELM page and running it successfully using (elm-reactor),
I have compiled it to generate the js file and open it using browser.
using the following command : elm-make pageName.elm --output target.js.
anyway the target.js page is generated successfully but when opening it using the browser it does not show the desired outcome instead it displays the source code as per the below screen shot
Run elm-make pageName.elm without --output target.js and open produced index.html
Alternatively, create your own *.html file and embed target.js via <script> tag, as you would normally do it for any other JavaScript files:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My app</title>
<script src="target.js"></script>
<script>
// Run the application manually.
Elm.Target.fullscreen();
<script>
</head>
<body>
</body>
</html>
Assuming that the name of the entry module is Target and you want it to take over the whole page.