now all targets start correctly...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-11-01 05:46:39 +03:00
parent d456103823
commit 82886db092
3 changed files with 20 additions and 50 deletions

View File

@ -4,11 +4,7 @@
*
**********************************************************************/
global.requirejs = global.requirejs || require('requirejs')
requirejs.config({
nodeRequire: require,
//baseUrl: __dirname,
var cfg = {
// XXX this does not work on direct filesystem access...
//urlArgs: 'bust='+Date.now(),
@ -37,7 +33,21 @@ requirejs.config({
//'ig-keyboard': 'lib/keyboard',
},
},
})
}
if(typeof(require) != 'undefined'){
cfg.nodeRequire = require
//cfg.baseUrl = __dirname
}
if(typeof(require) != 'undefined' && typeof(global) != 'undefined'){
global.requirejs = global.requirejs || require('requirejs')
}
requirejs.config(cfg)

View File

@ -84,7 +84,10 @@ if(window.require && window.nw){
<script>if (window.module) module = window.module;</script>
<script data-main="ui" src="ext-lib/require.js"></script>
<!--script data-main="ui" src="ext-lib/require.js"></script-->
<script src="ext-lib/require.js"></script>
<script src="cfg/requirejs.js"></script>
<script> requirejs(['ui']) </script>
</head>
<body>

View File

@ -15,43 +15,6 @@ if((typeof(process) != 'undefined' ? process : {}).__nwjs){
.addPath(path.dirname(process.execPath) + '/node_modules/')
}
//require('./cfg/requirejs')
//*
// Setup modules loaded from npm...
//
// XXX for some reason this breaks in browser if run after the if below...
// XXX not sure if this strategy is correct...
// ...most likely this is not actually a good idea, need to think of
// a way of organizing things without so much manual hoop jumping...
var requirejs_cfg = {
paths: {
//text: 'node_modules/requirejs-plugins/lib/text',
//json: 'node_modules/requirejs-plugins/src/json',
// XXX one approach to avoid at least this section is to copy the
// modules to lib/*, this way we'll need the map section below
// only... (without automation this also sounds bad)
'lib/object': './node_modules/ig-object/object',
'lib/actions': './node_modules/ig-actions/actions',
'lib/features': './node_modules/ig-features/features',
},
map: {
'*': {
// back-refs
// ...these enable the npm modules reference each other in
// a cross-platform manner....
'ig-object': 'lib/object',
'ig-actions': 'lib/actions',
'ig-features': 'lib/features',
},
},
}
// config the browser version of requirejs...
requirejs.config(requirejs_cfg)
//*/
// Setup requirejs if we are in node/nw...
//
@ -71,9 +34,6 @@ if(typeof(process) != 'undefined'){
// node stuff to node...
require('requirejs')
// config the node version of requirejs...
requirejs.config(requirejs_cfg)
nodeRequire =
global.nodeRequire =
window.nodeRequire =
@ -93,9 +53,6 @@ var viewer = require('imagegrid/viewer')
/*********************************************************************/
/*********************************************************************/
$(function(){