You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Imported js file in vbcs application throws Error: Mismatched anonymous define() module:

edited Jun 10, 2019 7:33AM in Visual Builder 2 comments

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> 

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!