IBM Worklight 6.1 - Uncaught ReferenceErrors: WLJQ

2019-05-10 08:31发布

I'm using IBM Worklight Developer Edition 6.1 installed in Eclipse Juno as my IDE and backbonejs as my main javascript framework for my project.

My index.html

<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
    <script>window.$ = window.jQuery = WLJQ;</script>

    <script data-main="js/main" src="js/libs/require/require.js"></script>
</head>
<body>

</body>
</html>

My main.js

require.config({
    paths: {
        jquery: 'libs/jquery/jquery-min',
        underscore: 'libs/underscore/underscore-min',
        backbone: 'libs/backbone/backbone-min',
        templates: '../templates',
        bootstrap: 'bootstrap.min',
        initOptions: 'initOptions',
        biiRibMobile: 'biiRibMobile',
        messages: 'messages'
    },
});
require(['app', ], function(App) {
    App.initialize();
});

My app.js

// Filename: app.js
define(['jquery', 'underscore', 'backbone', 'router', // Request router.js
'bootstrap', 'initOptions', 'biiRibMobile', 'messages', ], function($, _, Backbone, Router, bootstrap, initOptions, biiRibMobile, messages) {
    var initialize = function() {
            // Pass in our Router module and call it's initialize function
            Router.initialize();
        };
    return {
        initialize: initialize
    };
});

My initOptions.js

var wlInitOptions = {

    logger : {enabled: true, level: 'debug', stringify: true, pretty: false,
        tag: {level: false, pkg: true}, whitelist: [], blacklist: []},

    analytics : {
        enabled: false
        //url : ''
    }

};

if (window.addEventListener) {
    window.addEventListener('load', function() { WL.Client.init(wlInitOptions); }, false);
} else if (window.attachEvent) {
    window.attachEvent('onload',  function() { WL.Client.init(wlInitOptions); });
}

Thanks a lot in advance.

7条回答
叼着烟拽天下
2楼-- · 2019-05-10 09:01

This problem still occurs in v7.0.

While the cleaning of the TMPDIR works some times, it does not always do so - I can see no pattern here.

Rebooting my MACbook seems to work reliably, I speculate that this is because we get a new TMPDIR.

I just discovered that:

  1. Remove project from server
  2. Rename project (eg MyProjectZZZ)
  3. Rebuild and deploy, but don't bother to run
  4. Rename project back to MyProject
  5. Rebuild and deploy

Seems to clean things up

查看更多
登录 后发表回答