I have a main.js file in which I import all other js files, but the problem is the scripts from imported files are not executed in the same order that are imported.
My main.js looks like this:
import * as libs from './libs.js';
import * as utils from './utils.js';
import * as slider from './slider.js';
but in the main.js, after compiling, the slider script is run before utils, so utils are not available in slider.js
Is there a way to set order of imported files?
The content of my files is:
Utils.js:
let Utils = Utils || {};
(function($, window, document, app, undefined) {
'use strict';
app.isRwdSize = (size) => {
return size.css('opacity') === 1;
}
})(jQuery, window, document, Utils);
slider.js:
import * as utils from './utils.js';
let Utils= Utils|| {};
(function($, window, document, app, undefined) {
'use strict';
console.log(app); - shows empty object
})(jQuery, window, document, Utils);
main.js:
import * as libs from './libs.js';
//import * as utils from './utils.js'; - tried here and in slider.js
import * as slider from './slider.js';
Thanks in advance for any help Raf