Imported js file in vbcs application throws Error: Mismatched anonymous define() module:
Summary
Imported js file in vbcs application throws Error: Mismatched anonymous define() module:Content
Hi,
We've imported an external js file in our appn & exported its methods using AMD export syntax as below:-
define( ['jquery'], function($) {
var exports = {};
function mvtLaunch(locale) {
}
exports.mvtLaunch = mvtLaunch;
return exports;
});
We're calling this js file on click of a link from a page. It throws an error as below on first time click, (on 2nd time click it executes fine) :-
[VB 10:26:07 AM (ERROR), /vb/stateManagement/page]: Error: Mismatched anonymous define() module: function() {
-- entire cprjs.js file is displayed here--
}
We're importing this js file in our custom component's viewModel.js as -> define(['resources/js/cprjs'], function(cprjs){}); And we've also added it in index.html as -> <script src="resources/js/cprjs.js"></script>