I am converting old functional-based syntax Javascript to ES6 classes . Previously code was like this :
var SW;
if(SW.app === undefined) SW.app = {};
SW.app.NullLicense = (function () {
"use strict";
var NullLicense;
NullLicense = function () { };
NullLicense.prototype.handleLicense = function () {
var t1 = new SW.app.Utility();
return t1;
};
return NullLicense;
}());
Now with ES6 modules the code is like this
import {Utility} from './Utility.js'
export class NullLicense {
"use strict";
constructor(){ };
handleLicense () {
var t1 = new Utility();
return t1;
}
};
Since previously every module was concatenated to global SW variable we didn't have to worry about the dependencies issue.
In app/asset
we have our manifest file application.js
. It loads all the js files in the code base. Now since we have export
and import
commands in every file , I am getting this error that export declarations may only appear at top level of a module
.
I want to know what can be the workaround for this .
Thanks